-1
I’m having difficulty formatting the output code is working right, someone has idea how to fix the output
#include <iostream>
#include <cstdlib>
#include <clocale>
using namespace std;
int main(){
setlocale(LC_ALL, "");
int seq[5], contS = 0;
for(int i=1;i<=5;i++){
cout << "Digite o " << i << "º número: ";
cin >> seq[i];
contS = seq[i] + contS;
}
cout << "Os números digitados foram: ";
for(int i=1;i<=5;i++){
cout << seq[i] << " + ";
}
cout << " = " << contS;
return 0;
}
Input: 1 2 3 4 5
Expected exit: "The numbers typed were: 1+2+3+4+5 = 15"
Thanks buddy, I forgot about that operator
– Vinicius Santos
int i=1;i<=5
now that I’ve seen this is wrong. In c++ vectors span from Indice 0– Augusto Vasques