Hello, everyone I am pretty much a new programmer programming a little in C++ and
basic. I am having trouble with this portion of the program that I am working on.
When I include line 16, cin >>FullTimePartTime;
the program skips line 21, cin.getline(response,256);
and does not let me enter anything for the response variable.
But when I comment or delete out line 21 the program does fall through to the
else command and prints out what was entered in the response variable.
For you experinced C++ programmers, I need to know
1) why is this skipping line 21 with line 16 included and
2) I really don't need to include the cin >>FullTimePartTIme statement, how can I
get the program to work without inluding this statement.
3) I'm trying to write my program and this is bogging me down, as I have spent the
last 3 or 4 days( a couple hours each day ) trying to fix the problem. Do you
guys think I am spending to much time on one problem or should I continue with the
program so I can write another one.
__________________________________________________________________________________
#include <iostream>
#include <string>
using namespace std;
int main()
{
char key;
using namespace std;
string FullTimePartTime;
char response[256];
cout << "\n\nDO YOU NEED TO CALCULATE FULLTIME OR PARTIME EXPENSES? ";
cin >>FullTimePartTime; //cin is placed here program skips
//cin.getline(response,256)
cout << endl;
cout << "What is your name? "; //
cin.getline(response,256);
if (strlen(response) == 0)
cout << "\nYou must tell me your name...";
else
cout << "It's nice to meet you, " << response;
cout << "\ntype a key and hit return ";
cin >> key;
return 0;
}