- 论坛徽章:
- 224
|
从bs中截取的
<code>
[shell@localhost op]$ cat stl.cpp
#include <stdio.h>
#include <list>
#include <string>
using namespace std;
int main()
{
string s1 = "hello, world.";
string s2 = "I am new tester of stl in linux gcc.";
string s3 = "ok, now to show sm.";
string s4 = "this is the 4nd string";
string s5 = "end, bey...";
string sa = "my dog.";
list<string> srl;
std.push_back(s1);
std.push_back(s2);
std.push_back(sa);
std.push_back(s3);
std.push_back(s4);
std.push_back(s5);
list<string> iterator sit;
sit = std.begin();
for(; sit != std.end(); ++sit)
{cout<<"the size"<<*sit<<endl;
if(*it == "my dog.")
{cout<<"\tshall deletc: "<<*sit<<endl;
sit = std.earse(sit);
cout<<"\tthe size = "<<std.size()<<endl;
}
}
cout<<"proc shall exit."<<endl
sleep(100);
return 0;
}
[shell@localhost op]$ g++ stl.cpp -o op
stl.cpp: In function ‘int main()’:
stl.cpp:20: 错误:expected primary-expression before ‘.’ token
stl.cpp:21: 错误:expected primary-expression before ‘.’ token
stl.cpp:22: 错误:expected primary-expression before ‘.’ token
stl.cpp:23: 错误:expected primary-expression before ‘.’ token
stl.cpp:24: 错误:expected primary-expression before ‘.’ token
stl.cpp:25: 错误:expected primary-expression before ‘.’ token
stl.cpp:27: 错误:expected initializer before ‘sit’
stl.cpp:28: 错误:‘sit’ 在此作用域中尚未声明
stl.cpp:28: 错误:expected primary-expression before ‘.’ token
stl.cpp:30: 错误:expected primary-expression before ‘.’ token
stl.cpp:31: 错误:‘cout’ 在此作用域中尚未声明
stl.cpp:31: 错误:‘endl’ 在此作用域中尚未声明
stl.cpp:33: 错误:‘it’ 在此作用域中尚未声明
stl.cpp:35: 错误:expected primary-expression before ‘.’ token
stl.cpp:36: 错误:expected primary-expression before ‘.’ token
stl.cpp:40: 错误:‘cout’ 在此作用域中尚未声明
stl.cpp:40: 错误:‘endl’ 在此作用域中尚未声明
stl.cpp:42: 错误:expected `;' before ‘sleep’
[shell@localhost op]$
</code> |
|