Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// // labstruct.cpp // winter 2023 // // Created by Shuhuar Yeh on 1/31/23. // // Completed by ____________________ #include #include #include #include #include using

// // labstruct.cpp // winter 2023 // // Created by Shuhuar Yeh on 1/31/23. // // Completed by ____________________

#include #include #include #include #include

using namespace std;

const int LOC_SIZE = 10; struct Weather { char location[LOC_SIZE]; int precipitation; int humidity; int wind; };

Weather getWeather(); string formatWeather(Weather);

int main() { // Declare a weather structure variable named data // Write your code here . . . // Call getWeather function to read the weather data for a location // and store the data in the variable declared above // Write your code here . . . string output; // Call formatWeather function to format the weather data // and store the formatted output in the variable output. // Write your code here . . . // Insert output to cout cout << output; return 0; }

//****************************************************************************** //* Function: getWeather //* Description: read a line of comma separated weather data from the user and //* return a Weather value to the caller. //* Parameters: none //* Return: a Weather value that contains the weather data. //****************************************************************************** Weather getWeather() { // Create a temporary Weather variable Weather data = {}; // Write your code here . . . return data; }

//****************************************************************************** //* Function: formatWeather //* Description: Use the data stored in the Weather parameter and form an //* output string from the weather data. //* Parameters: //* data - contains the weather data of a location //* //* Return: a string value that contains the formatted output weather data. //****************************************************************************** string formatWeather(Weather data) { string result; // Write your code here . . . return result; }

Input

San Jose, 0, 40, 6

expected output

Loc Precip Humidity Wind

----------------------------------------

San Jose 0 40 6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions