Cin.get is not working!Help...

Is there a reason why my program executes the last cout command, but skips over the cin.get at the end?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <iomanip>

using namespace std;

int main ()
{
// variables
double adult;
double child;
double gross;
double net;
double child_price = 6;
double adult_price = 10;
double cut;
double cut_amt = (20/100);
string movieName;
double adultTickets;
double childTickets;

cout << "Enter name of movie" << endl;
getline(cin,movieName);
cout << "Enter how many adult tickets were sold";
adultTickets = cin.get();
cout << "Enter how many child tickets were sold";
childTickets = cin.get();
}
1
2
3
4
cout << "Enter how many adult tickets were sold";
adultTickets = cin.get();
cout << "Enter how many child tickets were sold";
childTickets = cin.get();


Correct code :
1
2
3
4
cout << "Enter how many adult tickets were sold";
cin >> adultTickets;
cout << "Enter how many child tickets were sold";
cin >> childTickets;


Seriously? cin.get() is for char variables not double.
Topic archived. No new replies allowed.