Skip to content

Instantly share code, notes, and snippets.

@krofna
Created June 11, 2012 08:22
Show Gist options
  • Save krofna/2909060 to your computer and use it in GitHub Desktop.
Save krofna/2909060 to your computer and use it in GitHub Desktop.
Za Mislava
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
inline string IntToString(int Integer)
{
stringstream convert;
convert << Integer;
return convert.str();
}
int StringToInt(const string& string)
{
stringstream buffer(string);
int a;
buffer >> a;
return a;
}
int main()
{
int polje[3] = { 5, 2, 3};
string polje_s;
int polje_i;
for(int i=0; polje[i]; ++i)
{
polje_s += IntToString(polje[i]);
}
polje_i = StringToInt(polje_s);
cout << polje_i << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment