0
I am starting in C++, during some tests I noticed that after the second iteration of while the Cin.getline command was not read displaying the line after it. I don’t understand what happens. Follow the code:
#include <iostream>
#include <fstream>
#include <string>
#include <cctype>
using namespace std;
int main(void) {
    char matter[20] = " ";
    string category(" ");
    ofstream write;
    bool control = true;
    char op = ' ';
    while (control) {
        cout << "Enter matter: ";
        cin.getline(matter, 20);//--------
        write.open("database.txt" , ofstream::app);
        write << "->" << matter << "\n";
        write.close();
        cout << "Prosseguir?[Y/N]:  ";
        cin >> op;
        op = toupper(op);
        if (op == 'N') {
          return 0;
        }
    }
}
If anyone knows what it is...