What I need to do is... make the output continuous. For example when I input a number it displays character it represents in the current message line. What I need is for each input to add to the next line. In other words when I input 39 I get G as current my next input is 79 and my output should be Go, however I just get the most recent input and not the string that i am inputting. Help please or suggestions. Thanks
This is my code:
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
string message; // holds the decrypted message
// Function Prototype
char decryptedLetter (int encryptedLetter);
void main(void)
{
int num = 0;
do
{
cout <<"\nEnter encrypted letter ( 0-94: -1 to exit): ";
cin >> num;
cout <<"Current message: " << decryptedLetter(num)<< endl;
message += decryptedLetter(num);
}
while(num >= 0 && num < 94 && num !=-1);
cout << endl;
cout << "\n"; // insert newline for readability
return;
}
char decryptedLetter (int x)
{
char encryptedLetter;
encryptedLetter = x +32;
return encryptedLetter;