I'm new to c++ and I have a problem with my project. This are the clues.
Convert an integer to string using the following code:
int number = 5; //any integer for example: 5
char s[100]; //an empty array of characters
itoa(number, s, 10); //conversion function. converting number to string s as a decimal (base 10).
string str += string(s); //You can concatenate your converted integer to another string or do whatever you want.
Example Input: 3
Output:
13 (it counts how many #3 in the input.)
1113 (it counts how many #1 & #3 from the output 13.)
3113 (it counts how many #1 & #3 from the output 1113.it will continue until
you exit the program)
int main()
{
int number;
char s[100];
cout << "Number: " << endl;
cin >> number;
itoa ( number, s, 10 );
cout << s;
system("pause");
return 0;
}
i dont know how to continue this..
for example my input is 2 the output should be 12 then if you press any key the program will process again and now the output should be 1112. this is infinite loop.