Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can you please fix the error in the code below to get the expected output?? ITS URGENT!!!!! #include #include #include #include #include using namespace std;

image text in transcribedcan you please fix the error in the code below to get the expected output?? ITS URGENT!!!!!

#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() { Weather data = {};

data = getWeather();

string output = formatWeather(data);

cout

return 0; }

Weather getWeather() { Weather data = {}; string input;

getline(cin, input); stringstream ss(input);

string loc; getline(ss, loc, ','); strncpy(data.location, loc.c_str(), LOC_SIZE); data.location[LOC_SIZE - 1] = '\0';

ss >> data.precipitation >> data.humidity >> data.wind;

return data; }

string formatWeather(Weather data) { stringstream result; result

return result.str(); }

Output differs. See highlights below. Special character legend 2:Compare output 0/3 Output differs. See highlights below. Special character legend

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

Recommended Textbook for

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions

Question

3. How has e-commerce transformed marketing?

Answered: 1 week ago