Code:
#include <iostream.h>
#include <string.h>
using namespace std;
int main ()
{
int i, n; NOTE, that the site breaks the alphabet[] string (repair it)
char alphabet[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\?!@#$%^&*(),.-_+=:<>/\\\'\"\t "; //assign A to alphabet[0], B to alphabet[1], etc.
string input, store;
getline (cin, input); //get input, note that you can also use getline for file input.
int input_length = input.length (); //store string lenth, since it will be modified
for (i = 0; i <= input_length; i++)
{
if (input.compare (0, 1, " ") == 0) //perforem a function, when a space is found, note that the last number will not be shown here.
{
n = atoi (store.c_str()); //assign the input number to a int.
cout << alphabet[n] ; // display alphabet[number].
input.erase (0, 1); // erase the space
store.erase (); //erase store so you can use it again.
}
store.append (input, 0, 1); //store one number at the time.
input.erase (0, 1); //erase the number that you assignd to the store string.
}
n = atoi (store.c_str());
cout << alphabet[n] << endl; //show the last number
}
So, if I input 07 30 37 37 40 88 22 40 43 37 29 63, I get "Hello World!"