One quick question: Can anyone find the error in this code, i cant seem to get the code to display a user-entered string correctly. It works with other programs but not with this one.
Code:
Code:#include <iostream>
#include <fstream>
#include <windows.h>
using namespace std;
int main()
{
cout<<"(1) Encode\n";
cout<<"(2) Decode\n";
cout<<"(3) Exit\n\n";
int choice;
cout<<"Choice: ";
cin>>choice;
if(choice==1)
{
//ENCODE
char string[100];
char enckey[100];
char newstr[100];
cout<<"\n\n"<<"--- ENCODER ---";
cout<<"\n\n";
cout<<"Enter String: ";
cin.getline(string, 100);
cin.ignore();
cout<<string<<endl;
cin.ignore();
}
return 0;
}
When it is supposed to display the string and pause, it continues and exits.
-NOTE: This program isn't finished yet (obviously).