Question: User Input The standard input device is usually the keyboard. Handling the standard input in C++ is done by applying the overloaded operator of extraction
User Input The standard input device is usually the keyboard. Handling the standard input in C++ is done by applying the overloaded operator of extraction (>>) on the cin stream. - The operator must be followed by the variable that will store the data that is going to be extracted from the stream. - For example: int age; cin>>age; The first statement declares a variable of type int called age, and the second one waits for an input from cin (the keyboard) in order to store it in this integer variable. cin can only process the input from the keyboard once the RETURN key has been pressed. - Even if you request a single character, the extraction from cin will not process the input until the user presses RETURN after the character has been introduced. Project 2 update the weather station application - request the user to provide: - Name of the weather station - Temperature - wind speed - wind direction Prints the weather station data to the console as: - TheWeather Station - put in an end line - Prints the current temperature in degrees Fahrenheit. - Put in an end line - Prints the current wind speed and direction (space between speed and direction) - put in an end line Get application to function correctly! coded in C++ C++ code:
#include
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< cout< cout< return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
