Answer to Question #276076 in C++ for Kha

Question #276076

Simple programming problem that is solvable using vector.



1
Expert's answer
2021-12-06T16:43:42-0500
#include <iostream>
#include <vector>

using namespace std;

int main()
{
  vector <int> foo = {1,2,3,4,5};
  int s = 0;
  for (int i = 0; i < 4; i++){
    sm += foo[i];
  } 
  cout << foo << '\n';
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment