Hey rob, if you feel like it, you might want to update your program to use the new, standard headers. That means <iostream> instead of <iostream.h>. There are lots of places to find information on the difference between the two, but to put it simply, the old headers will start to not work with newer compilers. There is one extra change you must make to your program if you change to the new header. Here are three examples of how you can do it. I prefer the first, but some, especially beginners, prefer the second or third (also note I added some indentation in there just for fun):
Code:
#include<iostream> //Allows Cin and Cout to be used
int main() //Allows starting of program
{
int temp;
std::cout <<"Please input the temperature\n\n:";
std::cin >>temp; //User input
if (temp>90)
{
std::cout <<"Spanish Weather : Wear shorts!\n"; //Prompt output based on user input
}
else if (temp>70)
{
std::cout <<"Ideal weather : Short sleaves are fine\n";
}
else if (temp>50)
{
std::cout <<"A little chilly : Wear a light jacket\n";
}
else if (temp>32)
{
std::cout <<"English weater : Wear a heavy coat\n";
}
else
{
std::cout <<"Stay inside\n";
}
return 0; //End the program
}
Code:
#include<iostream> //Allows Cin and Cout to be used
using std::cout;
using std::cin;
int main() //Allows starting of program
{
int temp;
cout <<"Please input the temperature\n\n:";
cin >>temp; //User input
if (temp>90)
{
cout <<"Spanish Weather : Wear shorts!\n"; //Prompt output based on user input
}
else if (temp>70)
{
cout <<"Ideal weather : Short sleaves are fine\n";
}
else if (temp>50)
{
cout <<"A little chilly : Wear a light jacket\n";
}
else if (temp>32)
{
cout <<"English weater : Wear a heavy coat\n";
}
else
{
cout <<"Stay inside\n";
}
return 0; //End the program
}
Code:
#include<iostream> //Allows Cin and Cout to be used
using namespace std;
int main() //Allows starting of program
{
int temp;
cout <<"Please input the temperature\n\n:";
cin >>temp; //User input
if (temp>90)
{
cout <<"Spanish Weather : Wear shorts!\n"; //Prompt output based on user input
}
else if (temp>70)
{
cout <<"Ideal weather : Short sleaves are fine\n";
}
else if (temp>50)
{
cout <<"A little chilly : Wear a light jacket\n";
}
else if (temp>32)
{
cout <<"English weater : Wear a heavy coat\n";
}
else
{
cout <<"Stay inside\n";
}
return 0; //End the program
}