first C++ class programming problem - need help

Write a program that accepts two numbers – temperature and day of week (if it is Sunday 1, otherwise 2. Display the following, if:
temperature < -10 and Sunday – Stay home.
temperature < -10 and not Sunday – Stay home, but call work.
temperature <= 0 (but >= -10) – Dress warm.
temperature > 0 – Work hard and play hard.
Hint: Use if and else if statements
*** Sample output
Please enter temporature: .5
Is it Sunday(Yes=1, No=2)? 1
Work hard and play hard.
Please enter temporature: -8
Is it Sunday(Yes=1, No=2)? 2
Dress warm.

My program:
#include <iostream>


using namespace std;
int main()

//declaring variables:
{

int temp = 1;
int day = 1;//Initialize the value of 'day' either ==1 or ==2


cout << "Is it Sunday (Yes=1, No=2)?" <<endl;
cin >> day;
cout << "Please enter temperature:" <<endl;
cin >> temp;

if(day ==1 && temp <=-10)cout << "Stay home" << endl;
else if (day==2 && temp <=-10)cout << "Stay home, but call work""." << endl;
else if (day==2 && temp <=0 && temp >=-10)cout<< "Dress warm"<<endl;
else if (day==2 && temp >0)cout<<"Work hard and play hard" <<endl;


system("PAUSE");
return EXIT_SUCCESS;
}
Last edited on
The problem is?

Also put your code between the code tags [code] Put code here [/!code] <--- remove the '!'
It did not work when I sent it. I ran it again and like magic, it works. Thank you for your time.
Lee
Topic archived. No new replies allowed.