I'm very new to programming and actively trying to teach myself C++. I'm trying to create a simple program that creates a vector, adds indexes in a for loop up to a value of 999, then reduces the vector back down to 0 indexes. My code is producing the VS error "too many arguments in function call". I've tried looking at other forum posts but I still can't quite understand what I'm doing wrong. My error exists in the second for loop at the line "index.pop_back(y);" here is my code, any additional coding tips help too, thanks.
My code:
#include <iostream>
#include <string>
#include <vector>
int main()
{
bool point_reached = 0;
std::vector<int> index = {};
for (int x = 0; x <= 999; x++)
{
index.push_back(x);
std::cout << index[x] << std::endl;
if (x == 999)
{
point_reached = 1;
std::cout << std::endl;
std::cout << "point reached!" << std::endl;
}
}
for (int y = 1000; y > 0; y--)
{
index.pop_back(y);
std::cout << index[y] << std::endl;
}
}