Converting string and int for using stringstream
#include<bits/stdc++.h> using namespace std; #define ll long long string int_to_str(int n) { stringstream ss; ss<<n; return ss.str(); } int str_to_int(string s) { stringstream ss(s); int n; ss>>n; return n; } int main() { ios_base::sync_with_stdio(0); string s; cout<<"Input string : "; cin>>s; int n; cout<<"Input integer : "; cin>>n; int m=str_to_int(s); string p=int_to_str(n); cout<<"String to integer convert: "<<m<<endl; cout<<"Integer to string convert: "<<p<<endl; }