Question: 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;

can you please fix the error in the code below to getcan 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!