The input and output are correct; the only problem is a comma at the end of the output. How do I make it so there is no comma at the end? C++

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter3: Understanding Structure
Section: Chapter Questions
Problem 7RQ
icon
Concept explainers
Question

The input and output are correct; the only problem is a comma at the end of the output. How do I make it so there is no comma at the end? C++

3 using namespace std;
4
5 int main()
6 {
7
8
9
10
11
12
13
14
15
16
17
18}
19
int size, temp;
vector<int> userInts;
cin>>size;
for(int i=0; i<size; i++){
cin>>temp;
userInts.push_back (temp);
for (int i-size-1; i>=0; i--)
cout<<user Ints[i]<<",";
C
return 0;
Develop mode
Enter program input (optional)
5246810
Submit mode
Run program
Program output displayed here
10, 8, 6, 4, 2,
Rui
inp
sec
Inpu
Transcribed Image Text:3 using namespace std; 4 5 int main() 6 { 7 8 9 10 11 12 13 14 15 16 17 18} 19 int size, temp; vector<int> userInts; cin>>size; for(int i=0; i<size; i++){ cin>>temp; userInts.push_back (temp); for (int i-size-1; i>=0; i--) cout<<user Ints[i]<<","; C return 0; Develop mode Enter program input (optional) 5246810 Submit mode Run program Program output displayed here 10, 8, 6, 4, 2, Rui inp sec Inpu
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Operators
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr