Question: Write a for loop to print all NUM_VALS elements of vector hourlyTemp. Separate elements with a comma and space. Ex: If hourlyTemp = {90, 92,

Write a for loop to print all NUM_VALS elements of vector hourlyTemp. Separate elements with a comma and space. Ex: If hourlyTemp = {90, 92, 94, 95}, print:

90, 92, 94, 95 

Your code's output should end with the last element, without a subsequent comma, space, or newline.

#include #include using namespace std;

int main() { const int NUM_VALS = 4; unsigned int i; vector hourlyTemp(NUM_VALS);

for (i = 0; i < hourlyTemp.size(); ++i) { cin >> hourlyTemp.at(i); }

/* Your solution goes here */

cout << endl;

return 0; }

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!