lundi 8 février 2021

How to take string(with spaces) array as input?

The first character is not getting read by the cout.

        string arr[10000];
        for(int i=0;i<n;i++) {
            cin.sync();
            cin.ignore();
            getline(cin, arr[i]);
            cout<<arr[i]<<" ";
        }

Aucun commentaire:

Enregistrer un commentaire