Program displays a list of numbers. For example:
1, 3, 5, 3, 4, 3,
I need to be like this:
1, 3, 5, 3, 4, 3
I tried the if/else
statement, but its no good.
s.push_back(0);
cout << "s: ";
cout << 0 << ", ";
s.push_back(v[0]);
cout << s.back() << ", ";
for(int i=2; i<=10; i++) {
s.push_back(alpha * v[i-1] + (1 - alpha) * s.back());
if (i == s.back() - 1)
cout << s.back() << endl;
else
cout << s.back() << ", " << "";
I'm getting the correct output. Just having trouble with getting rid of the last comma.