so,i'm trying to do a conversion(integer to string) and then add this string with another.But it seems stringstream is not working..(it's normally working but the loop causes troubles) I'm done with google & almost tried everything but can't get this code to work..Anyone help me :( ?
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main()
{
int n;
cin>>n;
string arr[n];
string a;
int i=0;
int s;
int c;
cin>>a;
arr[i] = a;
i++;
cout<<"OK"<<endl;
n--;
while(n--)
{
cin>>a;
s = 0;
for(int j=0;j<i;j++)
{
if(arr[j] == a)
{
s = 1;
break;
}
}
i++;
if(s == 0)
{
arr[i] = a;
cout<<"OK"<<endl;
}
else
{
c++;
stringstream ss;
ss<<c;
string m = ss.str();
a+=m;
arr[i] = a;
cout<<a<<endl;
ss.str("");
ss.clear();
}
}
return 0;
}