Ok, I entered the code as it was in the textbook I'm reading, but the compiler is giving me an error on the 2nd-4th line from the code below, saying 'v' does not name a type. Can someone tell me what is wrong here?
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
usingnamespace std;
inlinevoid keep_window_open() {char ch; cin>>ch;}
// The above code uses the standard library directly, eliminating the need for the std_lib_facilities.h
vector<int> v(3);
v[0]=5;
v[1]=7;
v[2]=9;
int main ()
{
cout<<v[0];
}