Okay so i am in the middle of learning C++ and i have come across an error i don't understand. My code is as follows...
#include <iostream>
#include <string>
using namespace std;
int main() {
int x;
cin >> x;
if (x == 1) {
cout << "Red" << endl;
}
else if (x == 2) {
cout << "blue" << endl;
}
else if (x == 3) {
cout << "green" << endl;
}
else if (x == 4) {
cout << "orange" << endl;
}
else if (x == 5) {
cout << "pink" << endl;
}
string y;
getline(cin, y);
return 0;
}
So my issue is that the it seems to skip past the getline(cin, y) at the end. My guess is that it is just something really obvious but i cant see anything. Thanks in advance for any help.