Image

Imagetransmogrify wrote in Imagecpp

ascii conversion

I have to write a program for class that will convert an entire sentence into ASCII. I've made it so that it can convert a single word, but how do I alter it to handle a sentence?


#include <iostream.h>

int main()
{
char word[32];
int x = 0;
cout << "Please enter the word (maximimum is 32 characters):\n";
cin >> word;
cout << "The ASCII for this word is:\n";
while (word[x] != '\0')
{
cout << int(word[x]);
x++;
}
cout << "\n";
return 0;
}


cross posted in Imagecoders_haven