The getline(cin, s1) function is not prompting me to input a string. it appears as if it is being skipped over even when the if condition is being met. any help? code is below. the problem is in the first if statement.
//Exercise 3.2
#include "stdafx.h"
#include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::string;
int main(){
char a1;
 cout << "Read line (L) or word (W)?:";
cin >> a1;
if (a1 == 'l'){
    string s1;
    getline(cin, s1);
    cout << s1 << endl;
}
else{
    string s1;
    while (cin >> s1){
        cout << s1 << endl;
    }
}
system("pause");
 return 0;   
}
 
    