lundi 27 juin 2022

How to store full name with whitespace in array c++? [duplicate]

I want to store the full name in array with whitespace but when I type the name, the run to exit. Can you guys help me?

int main()
{
int user1, user2;
char name[100][10000];
int num[10000];
int temp;
cout << "Number of students: "; cin >> user1; cout << "\n";
for(int i = 0; i < user1; i++)
{
    cout << "Students No." << i + 1; 
    cout << "\nName: "; cin >> name[i];
    cout << "Num: "; cin >> num[i];
    cout << "\n";
}

Aucun commentaire:

Enregistrer un commentaire