-
thanks for all the help. but lol. now it's more of a trojan/ memory killer
Code:
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
unsigned long newVal;
int wtd;
int en;
int key = rand();
unsigned long messagete;
sao:
cout<<"1- Decode 2- Encode"<<endl;
cin>>wtd;
if(wtd == 2) {
cout<<"What message would you like to encode? Max: 500 letters + spaces!"<<endl;
cin>>messagete;
newVal = messagete + key;
newVal %= 256;
char convertedChar = newVal - 128;
cout<<"The encoded message is: ||| " << messagete << " ||| and the secret number is " << key <<endl;
} else if(wtd == 1) {
}
goto sao;
system("PAUSE");
return 0;
}
I tried to re-set the variables to 0 but then it kept on repeating "1- Decode 2- Encode"
-
sigh. You can't input a string into an unsigned long. Read about strings, for loops, while loops, do while loops. Then read about why goto is bad. And look at your code... it's an infinite loop, since you goto sao; no matter what.