#include<iostream> using namespace std; int main() { //declaring variables to ho
ID: 3887309 • Letter: #
Question
#include<iostream>
using namespace std;
int main()
{
//declaring variables to hold the weather station name, temperature, wind speed and direction
string weather_station,wind_direction;
double temperature;
int wind_speed;
//assigning some values to the variables
weather_station="New York";
temperature = 101;
wind_speed=45;
wind_direction="south";
//printing the variables
cout<<The"<<weather_station<<"Weather Station"<<" ";
cout<<temperature<<" degree F"<<" ";
cout<<wind_speed<<" "<<wind_direction<<" ";
return 0;
}
Explanation / Answer
#include<iostream>
using namespace std;
int main()
{
//declaring variables to hold the weather station name, temperature, wind speed and direction
string weather_station,wind_direction;
double temperature;
int wind_speed;
//assigning some values to the variables
cout<<"Enter Name of the weather station: ";
getline(cin, weather_station);
cout<<"Enter Temperature: ";
cin >> temperature;
cout<<"Enter wind speed: ";
cin >> wind_speed;
cout<<"Enter wind direction: ";
cin >> wind_direction;
//printing the variables
cout<<"The "<<weather_station<<" Weather Station"<<" ";
cout<<temperature<<" degree F"<<" ";
cout<<wind_speed<<" "<<wind_direction<<" ";
return 0;
}
Output:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.