C++におけるint回転stringとstring回転int

2794 ワード

#include "stdafx.h"
#include "string"
#include "iostream"
#include "vector"
#include "sstream"
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    //string   int
    stringstream ss;
    string str;
    int i;
    ss<<"100";
    ss>>i;
    i=i+100;
    cout<<i<<endl;//    200

    //int   string
    stringstream ssm;
    ssm<<5;
    str=ssm.str();
    str=str+"8";
    cout<<str;//    58
    getchar();

    return 0;
}