#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <math.h>
#include <windows.h>
using namespace std;
int main()
{
int l, pos, pos1;
unsigned long int currnum;
string str0, str1;
stringstream out;
string::iterator x1, x2;
float koren;
bool find = 0;
ifstream fin("koren.in");
ofstream fout("koren.out");
if(fin.is_open())
{
fin>>l;
fin>>str0;
fin.close();
currnum=159;
while(find==0)
{
koren=sqrt(currnum);
out<<koren;
str1=out.str();
pos=str1.find(".");
if(pos!=string::npos)
{
str1.erase(pos+1+l);
if(str1.find(str0, pos)!=string::npos)
find=1;
else
currnum++;
}
else
{
currnum++;
}
out.str(string());
}
fout<<currnum;
fout.close();
}
else
{
cout<<"Fajlot nemoze da se otvori";
}
return 0;
}
It crashes when currnum gets to 156