Please assume the user will always type in one, I have not gotten to the part of the code where the user will input text to decrypt. Anyways, whenever I run this code the program seems to just skip over the first word in user input and encrypt the rest of the text. I am completely dumbfounded as to why this is.
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
int main()
{
cout<< "Do you want to encrypt or decrpyt your file?" << endl;
cout<< "Type 1 for encrytion"<<endl;
cout<< "Type 2 for decrption"<<endl;
string silence;
int choice;
cin>> choice;
if(choice== 1)
{
cout<< "Please enter a string to encrypt: ";
cin>> silence;
getline(cin,silence);
for(int i =0; i < silence.length();i++)
{
if (isalpha(silence[i]))
cout<< char(silence[i]+1);
else cout<<silence[i];
}
}