I'm very new to programming, and I'm having trouble using getline in a while loop. When I cout the course variable the first letter is missing. Getting rid of cin.ignore sends it into an infinite loop.
Here's what I have so far:
#include <iostream>
#include <string>
using namespace std;
int main (){
string answer = "Yes";
string course;
while (answer == "Yes"){
cin.ignore();
cout<< "Enter a course name: ";
getline (cin, course);
cout<< course << endl;
cout<< "Continue ('Yes' or 'No')? ";
cin>> answer;
cout<< answer << endl;
}
return 0;
}