i am working on a basic program to encrypt/decrypt a message based on numbers being equal to a letter.
i am wondering how i can use cin.get() and cin.ignore() to get the next number in the sequence. right now all the code does is read the first number and print it out as the corresponding character. but if i wanted to input say 8 5 9 9 15 (which would need to be printed out as hello) all at once and without using strings or arrays how would i do this?
int code, length=0;
int count=0;
cout<<"Enter the length of your message: ";
cin>>length;
cout<<"Enter the coded phrase: ";
cin>>code;
while(count<length){
count++;
if(code!=0 && code != 27){
code += 96;
cout<< (char) code;
}
cin.get(code); //the problem is here. im not sure if this is even the correct usage
}