#include <iostream.h>
int main()
{
char word[32];
int x = 0;
cout << "Please enter the word (maximum 32 characters):\n";
cin >> word;
cout << "The ASCII for this word is:\n";
while (word[x] != '\0') // While the string isn't at the end...
{
cout << int(word[x]); // Transform the char to int
x++;
}
cout << "\n";
return 0;
}
This is a program convert a string to ASCII.
Example: string is "hi", the output is 104105.
But the progam displays the number 104 then displays the number 105.
So, how can I save the number "104105" in an integer variable to use later?