I would like this program to display each value of n, multiplied by the variable currentprimenumber to be pushed into the all_numbers vector array and then for each integer in the vector array to be displayed. To be honest with you, I cant figure out what to put in the code statement
std::cout<< "something to display the vector elements here"<<std::endl;
I tried a few things already like
std::cout << n << std::endl;
// i get the numbers from 3 o 49 but they arent multiplied to the currentprimenumber, thats the issue :(
std::cout << all_numbers.size() << std::endl; // but i got a list of ones
std::cout << all_numbers[n] << std::endl; // i got Debugger assertion failed
Then I tried toggling with the brackets to see if its a scope issue I ran to here because at this point I was making the same mistakes all over again Heres my code below
int main(){
for (int n = 3; n < 50; n++) {
int currentprimenumber = 2;
std::vector<int>all_numbers;
if (n*currentprimenumber)
all_numbers.push_back(n);
for (int n : all_numbers)
std::cout << n << std::endl;
//} // if(n*currentprimenumber)
}//for (int n = 3; n < 50; n++)
} // int main()`
Aucun commentaire:
Enregistrer un commentaire