Subscribe For Free Updates!

We'll not spam mate! We promise.

Wednesday 14 August 2013

Displaying Season Code in C++


User inputs three temperature from keyboard and program checks it individually that while the temperature occur in Winter, Spring or Summer Season and it show reasult.

#include<iostream.h>
#include<conio.h>

int main()
{

clrscr();
float temp_1, temp_2, temp_3;
cout<<"\nEnter 1st temperature: ";
cin>>temp_1;
if(temp_1>=1 && temp_1<=10)
cout<<"\nWinter Season!!";
else if(temp_1>=11 && temp_1<=30)
cout<<"\nSpring Season!!";
else if(temp_1>=31 && temp_1<=50)
cout<<"\nSummer season!!";
else
cout<<"\nInvalid option!!";
cout<<"\n\n\nEnter 2nd temperature: ";
cin>>temp_2;
if(temp_2>=1 && temp_2<=10)
cout<<"\nWinter Season!!";
else if(temp_2>=11 && temp_2<=30)
cout<<"\nSpring Season!!";
else if(temp_2>=31 && temp_2<=50)
cout<<"\nSummer season!!";
else
cout<<"\nInvalid option!!";
cout<<"\n\n\nEnter 3rd temperature: ";
cin>>temp_3;
if(temp_3 >=1 && temp_3<=10)
cout<<"\nWinter Season!!";
else if(temp_3 >=11 && temp_3<=30)
cout<<"\nSpring Season!!";
else if(temp_3 >=31 && temp_3<=50)
cout<<"\nSummer season!!";
else
cout<<"\nInvalid option!!";
getch();
return 0;
}

Socializer Widget By CodingLovers
SOCIALIZE IT →
FOLLOW US →
SHARE IT →

0 comments:

Post a Comment