0% found this document useful (0 votes)
58 views

Assignment CSC425-NABIL

The document is a C++ program that takes user input for temperature and humidity values and outputs an activity recommendation based on the conditions. It first prompts the user to enter a temperature and humidity. It then uses if/else statements to check whether the temperature is warm or cold, and whether the humidity is dry, humid, or an error value to output different activity suggestions like "play tennis", "swim", "play basketball", or "watch tv".

Uploaded by

nabil mahadzir
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

Assignment CSC425-NABIL

The document is a C++ program that takes user input for temperature and humidity values and outputs an activity recommendation based on the conditions. It first prompts the user to enter a temperature and humidity. It then uses if/else statements to check whether the temperature is warm or cold, and whether the humidity is dry, humid, or an error value to output different activity suggestions like "play tennis", "swim", "play basketball", or "watch tv".

Uploaded by

nabil mahadzir
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment CSC425

Name:MUHAMMAD NABIL BIN MAHADZIR


Class:2A4
#include <iostream>

using namespace std;

int main() {
string temperature;
string humidity;

cout << "Enter temperature";


cin >> temperature;
cout << "Enter humidity";
cin >> humidity;

if (temperature == "Warm") {
if (humidity == "Dry") {
cout << "play tennis" << endl;
} else if (humidity == "Humid") {
cout << "swim." << endl;
} else {
cout << "Error value." << endl;
}
} else if (temperature == "Cold") {
if (humidity == "Dry") {
cout << "play basketball." << endl;
} else if (humidity == "Humid") {
cout << "watch tv." << endl;
} else {
cout << "Error value" << endl;
}
} else {
cout << "Error value" << endl;
}

return 0;
}

You might also like