#include<iostream>
#include <sstream>
using namespace std;
int main()
{
//做除法时会经常遇到
/*int num=17,count=5;
double mean;
mean=(double)num/count;
cout<<mean<<endl;
//
//
char a='3';int b=a-'0';
cout<<a+50<<" "<<b+50<<endl;
//
char s;int t=3;
s=t+'0';cout<<s+50<<" "<<t+50<<endl;
*/
string str="123";
stringstream ss;
ss<<str;
int num;
ss>>num;
cout<<num<<endl;
string t;
stringstream ss2;
ss2<<num;
t=ss2.str();
cout<<t<<endl;
return 0;
}
stingstream是一个大口袋,什么都能,用这个做转换很方便
09-01