string to int

 #include <iostream>
#include <stdio.h>
using namespace std;
void main()
{
 string stc="123";
 int test1;
 sscanf(stc.c_str(),"%d", &test1);
 if(test1==123)
 cout<<test1<<endl;
 getchar();
}
posted @ 2011-10-19 10:30  byfei  阅读(111)  评论(0编辑  收藏  举报