I'm building a simple program to translate a sentence typed in into l33t. (I know, it's stupid, but I thought it would be a good programming exercise for me.) I have hit a road block of sorts. I have a loop that contains the main part of the program, and in that loop I have a
getline()(
string:: I think?) to get typed text into a string object. Well, the program works perfectly until the client wants to run the loop again. On the second time around it seems that the
getline() doesn't except the input and skips directly to the part where it asks the user if he/she wants to go through the process again. Here is my code and help would be appreciated. Thanks.
// main.cpp -- this will contail the main body of the new leetspeek program
#include <iostream>
#include <string>
#include <cstdlib>
#include "LEETlib.h"
using std::cout;
using std::endl;
using std::cin;
using std::string;
using LEETlib::leetio;
int main()
{
int skp = 0;
char again = 'y';
while(again != 'n')
{
string eng;
if(skp == 0)
{
cout << "Programed by Shawn Stovall\n03-14-2008\nv0.8\n\n";
skp += 1;
}
cout << "Please type in a line you would like to change into |_337: ";
getline(cin, eng);
leetio(eng);
cout << "\nWould you like to translate another group of words? (y/n) ";
cin >> again;
}
cout << "\nGoodbye!\n\n";
system("PAUSE");
return 0;
}