my job is to create a lesson on debugging, and so i thought a simple out of bounds error would work....but this compiles and runs with no fatal errors! I even changed the one for loop from 4 to 5 and it didn't even change the way the program executed, ie it still only asked for 4 names? I'm losing my mind here. Oh and if anyone can tell me a quick solution to the warnings produced by having a vector of strings, thanksCode:#include<iostream> #include<string> #include<vector> using namespace std; int main() { vector<string> strNames(3); for( int i = 0; i < 4; i++ ) cin >> strNames[i]; cout << endl << endl; for( i = 0; i < 3; i++ ) cout << strNames[i] << endl; return 0; }




Reply With Quote