I'm new to programming and trying to do my assignment. I dont understand why the second cin.get is not working. I've tried changing it to cin >> but is still not working.
#include <iostream>
using namespace std;
int main()
{
struct student_type
{
char name[50];
int score[100];
float grade;
};
student_type student[5];
int index;
for (index = 0; index <= 4; ++index)
{
cout << "\n Enter the name of the " << index + 1 << " student: ";
cin.get(student[index].name, 50);
cout << "\n Enter the score of the " << index + 1 << " student; ";
**cin.get**(student[index].score, 100);
if (student[index].score **>=** 98)
{
student[index].grade = 1.00;
}
}
}
Aucun commentaire:
Enregistrer un commentaire