C++ 字符串转化数值

void main()
{

 #include <stdlib.h>
 string  score = "98";
 int res = atoi(score.c_str());
 cout << res <<endl;
    int result;
    cin >> result ;

}

 

 

#include "People.h"
#include <sstream>
#include <iostream>


void main()
{

 int dataInput;
 cin >> dataInput;
 stringstream sstr;
 sstr << dataInput;
 string sstrResult = sstr.str();
 cout << sstrResult;

    int result;
    cin >> result ;

}

posted @ 2013-06-05 19:47  Predator  阅读(133)  评论(0编辑  收藏  举报