Im suppose to create a loop that takes in a string input number and turn it to a integer variable so i could add 1 to the number and then turn it back to a string and print it out 5 times with 1 added to the number per print.The problem is, it only works up to 9 digits. if you put more then 9 then it starts giving other different numbers like -125346543.
if you put 9 digits 101010101. it will print it out 101010101 -> 101010106, but if you put 10 digits like 1010101010. it will print out -128764798 -> 128764804. I need it to print a least up to 13 digits
#include <iostream>
#include <string>
#include <sstream>
int main() {
int l=0;
int x=0;
string nope;
cout<<"please provide 13 digit code : ";
cin>>nope; // ask for 13 digit code
for(i=0; i < 5 ; i++)
{
stringstream geek(nope); // turn string to Int
geek>>x;
l = x + 1; // add 1 to Int
stringstream ss; // turn it back to string
ss << l;
string q = ss.str();
nope = q;
cout<<nope; // prints out
}