I have a for loop that prints a comma and a space after each item in a list. It is also outputting a comma and space after the last item in the list. How do I get rid of this?
for (i = 0; i < NUM_VALS; ++i) {
cin >> hourlyTemp[i];
}
for (i = 0; i < NUM_VALS; i++) {
cout << hourlyTemp[i];
cout << ", ";
}
My output is : 90, 92, 94, 95, I want it to be : 90, 92, 94, 95