Awee help

ok so i just need a quick answer and then ill delete this thread so that way it dont take up room i programmed befor and i haven't in all most 2 years but im back now and loving it but can yall tell me why this code skips the last input and goes stright to end of program
it skips the getline(emotion) part and goes to end of program just need to understand this befor i can really keep going it's stumping me every time i try
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
//#include <iomanip>
//#include <cstdio>

using namespace std;

int main(){

string food,emotion;
int money;

cout << "Hello? hello?? ah yes well i hear alot about you but im missing a few things mind filling it out for me what kinda food you you like?\n";
getline(cin,food);
cout << " Ah yes i should have remember you liked " << food << "Ok ah do you mind if i ask how much you spent on it? \n";
cin >> money;
cout << " Ah yes how they are kinda pricey they are when you got this what where you feeling??? " << endl;

getline(cin,emotion);
cout << " Oh really you felt " << emotion << " How neat to hear well any ways Good to meet you again my old friend \n\n\n";

    return 0;
}
Last edited on
There is an extra '\n' in the input stream.
try adding std::cin.ignore(); on line 17
ty very much man it works but now may i ask why does that work??
Last edited on
Topic archived. No new replies allowed.