Java tutorial video taught by Mr. Rightwing

Qaybta Xirfada Sayniska iyo iwm

Moderators: Moderators, Junior Moderators

User avatar
Rightwing
SomaliNet Super
SomaliNet Super
Posts: 9248
Joined: Mon Dec 23, 2002 7:00 pm
Location: Maqaamka lagu xadreeyo MEDED, MEDED
Contact:

Java tutorial video taught by Mr. Rightwing

Post by Rightwing »

The power of the loop

Addoow
SomaliNet Super
SomaliNet Super
Posts: 7611
Joined: Sat Aug 16, 2008 4:13 am
Location: Hawiye Pride!

Re: Java tutorial video taught by Mr. Rightwing

Post by Addoow »

A C++ Program to calculate the average of four numbers.



#include<iostream.h>

int main()
{
using namespace std;
float num,sum=0,average;
cout<<"enter the first number\n";
cin>>num;
sum=sum+num;
cout<<"enter the second number\n";
cin>>num;
sum=sum+num;
cout<<"enter the third number\n";
cin>>num;
sum=sum+num;
cout<<"enter the fourth number\n";
cin>>num;
sum=sum+num;
average=sum/4.0;
cout<<"the average of the four numbers is "<<average<<endl;
system("pause");
return 0;





















}
Addoow
SomaliNet Super
SomaliNet Super
Posts: 7611
Joined: Sat Aug 16, 2008 4:13 am
Location: Hawiye Pride!

Re: Java tutorial video taught by Mr. Rightwing

Post by Addoow »

\\A C++ Program For Temperature Conversion using if else statement.

#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
using namespace std;
int main()
{

char temptype;
float temp,ctemp,ftemp;
cout<<"enter the temperature to be converted";
cin>>temp;
cout<<"enter F if the temperature you entered is in fahrenheit "<<endl;
cout<<"or C if the temperature you entered is in celcius "<<endl;
cin>>temptype>;


cout<<setiosflags(ios::fixed)
<<setiosflags(ios::showpoint)
<<setprecision(2);


if(temptype=='f')
{
ctemp=(9.0/5.0)*(temp-32);

cout<<"the equivalent temperature in celcius is "<<ctemp<<endl;

}

else

{

ftemp=5.0/9.0*temp+32;

cout<<"the equivalent temperature in fahrenheit is "<<ftemp<<endl;
}

system("pause");
return 0;


}



A subsequent implementation of this program in dev++ compiler results in this








Image

Uploaded with ImageShack.us]
User avatar
Rightwing
SomaliNet Super
SomaliNet Super
Posts: 9248
Joined: Mon Dec 23, 2002 7:00 pm
Location: Maqaamka lagu xadreeyo MEDED, MEDED
Contact:

Re: Java tutorial video taught by Mr. Rightwing

Post by Rightwing »

Maansha allah sxb pm isoo dir. Waxaad tahay dadka la rabo in wax u qabtaan wadankiiyo. Maanta aduunkoo dhami software ayuu ku xidhanyahay.

Cheer RW
Addoow
SomaliNet Super
SomaliNet Super
Posts: 7611
Joined: Sat Aug 16, 2008 4:13 am
Location: Hawiye Pride!

Re: Java tutorial video taught by Mr. Rightwing

Post by Addoow »

Another one which calculates the distance b.w two points in space by utilizing the power of the infinite loop.


#include<iostream.h>
#include<math.h>
int main()


{
float x1,x2,y1,y2;
float distance;
int count=1;
cout<<"This program allows you to calculate the distance b/w two points :\n";
while(count<=1)
{
cout<<"Enter the first co-ordinate of the points"<<endl;
cin>>x1;
cout<<"Enter the second co-ordinate of the points"<<endl;
cin>>x2;
cout<<"Enter the third co-ordinate of the points"<<endl;
cin>>y1;
cout<<"Enter the fourth of co-ordinate of the points"<<endl;
cin>>y2;

distance=sqrt(pow(x2-x1,2.0)+pow(y2-y1,2));
cout<<"The distance b/w these points equals :"<<distance<<"\n";
count--;

}
system("pause");
return 0;






}





The program

Image

Uploaded with ImageShack.us
Addoow
SomaliNet Super
SomaliNet Super
Posts: 7611
Joined: Sat Aug 16, 2008 4:13 am
Location: Hawiye Pride!

Re: Java tutorial video taught by Mr. Rightwing

Post by Addoow »

Maansha allah sxb pm isoo dir. Waxaad tahay dadka la rabo in wax u qabtaan wadankiiyo. Maanta aduunkoo dhami software ayuu ku xidhanyahay.

Cheer RW
Thanks,Check Your PM bro....
User avatar
Rightwing
SomaliNet Super
SomaliNet Super
Posts: 9248
Joined: Mon Dec 23, 2002 7:00 pm
Location: Maqaamka lagu xadreeyo MEDED, MEDED
Contact:

Re: Java tutorial video taught by Mr. Rightwing

Post by Rightwing »

Addoow wrote:
Maansha allah sxb pm isoo dir. Waxaad tahay dadka la rabo in wax u qabtaan wadankiiyo. Maanta aduunkoo dhami software ayuu ku xidhanyahay.

Cheer RW
Thanks,Check Your PM bro....

Adoow
yr desktop is messy sxb.
Locked
  • Similar Topics
    Replies
    Views
    Last post

Return to “Careers - Engineering, Science & Computers”