why cin.getline is skipping one character?
Here is code:
#include <iostream>
using namespace std;
int main(){
char b[5];
cin.ignore();
cin.getline(b,5);
cout << b;
return 0;
}
if I removed cin.ignore(); then it will skip the last character.. Example If i input abcde it will show now bcde When I removed cin.ignore(); it will show abcd