i am writing a program which will find a string from an array of strings.
my errors >PHP Code:
#include<iostream>
#include<cstdlib>
#include<string>
#include<cmath>
#include<vector>
using namespace std;
typedef std::<vector std::string> str;
str s("abcd","efgh","ijkl","mnop","123"); // string initialized
int main()
{
string s1="ijkl"; // target string
std::vector<std::string> iterator p ;
for(iterator p = s.begin(); p!=s.end();p++)
{
if( s1==s[p]) cout<<"string has been found"<<endl; // string has been found
}
int n = atoi("123"); // is it possible in C++ ?
cout<<n<<endl;
}
error C2589: '<' : illegal token on right side of '::'
error C2589: '<' : illegal token on right side of '::'
warning C4091: 'typedef ' : ignored on left of 'int' when no variable is declared
error C2143: syntax error : missing ';' before '::'
error C2143: syntax error : missing ';' before '::'
error C2955: 'vector' : use of class template requires template argument list
c:\program files\microsoft visual studio\vc98\include\vector(244) : see declaration of 'vector'
error C2146: syntax error : missing ';' before identifier 's'
error C2501: 'str' : missing storage-class or type specifiers
fatal error C1004: unexpected end of file found
Error executing cl.exe.
why these errors ? how can i fix those errors ?
thanks



LinkBack URL
About LinkBacks


