My code keeps putting the input statements on the same line, instead of
letting me input them normally; here's the code:
int main()
{
cout << "Encrypt or decrypt?[1=encrypt|0=dec rypt] ";
bool select;
cin >> select;
if(select==true )
{
string cleartext;
string key;
cout << "Enter the cleartext: " << endl;
getline(cin,cle artext,'\n');
cout << "Enter the key: " << endl;
getline(cin,key ,'\n');
string ciphertext(encr ypt(cleartext,k ey));
cout << "Ciphertext : " << ciphertext << endl;
}
string ciphertext;
string key;
cout << "Enter the ciphertext: ";
getline(cin,cip hertext,'\n');
cout << "Enter the key: ";
getline(cin,key ,'\n');
string decrypted(decry pt(ciphertext,k ey));
cout << "Cleartext: " << decrypted << endl;
system("PAUSE") ;
return EXIT_SUCCESS;
}
Can you help me? Thanks.
letting me input them normally; here's the code:
int main()
{
cout << "Encrypt or decrypt?[1=encrypt|0=dec rypt] ";
bool select;
cin >> select;
if(select==true )
{
string cleartext;
string key;
cout << "Enter the cleartext: " << endl;
getline(cin,cle artext,'\n');
cout << "Enter the key: " << endl;
getline(cin,key ,'\n');
string ciphertext(encr ypt(cleartext,k ey));
cout << "Ciphertext : " << ciphertext << endl;
}
string ciphertext;
string key;
cout << "Enter the ciphertext: ";
getline(cin,cip hertext,'\n');
cout << "Enter the key: ";
getline(cin,key ,'\n');
string decrypted(decry pt(ciphertext,k ey));
cout << "Cleartext: " << decrypted << endl;
system("PAUSE") ;
return EXIT_SUCCESS;
}
Can you help me? Thanks.
Comment