HI,
I took this code from the example given by the expert...
but it seem has error...
its error is
Error E2451 test9.cpp 11: Undefined symbol 'vector' in function main()
Error E2294 test9.cpp 17: Structure required on left side of . or .* in function main()
the point is i want to copy only string "A" from the whole string if only it detect "object Class" from the string...
so i need the loc indec to be just at the end of "object Class" so i can store string "A" into file....Code:#include <string> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <iostream> #include <fstream> using namespace std; int main() { vector<int> v( 5, 1 );// --> error string str; str = "object Class A"; int v; for( int i = 0; i < 20; i++ ) { cout << str << i << " is " << v.at(i) << endl; ofstream myfile ("example.txt",ios::app); //open file if (myfile.is_open()) { if (i <= 12) //for every (ch <=12 ) will be store {myfile<<v.at(i);} } myfile.close(); } return 0; }
what is the problem can u help me guys?