- 1
complie error
what is the error here #include <iostream> #include <string.h> using namespace std; struct student { int id; float gpa; string gender; }; int main() { student a[10]; for (int i=0;i<10;i++) { cout<<"enter id , gpa, gender"; std::cin>> a[i].id << a[i].gpa << a[i].gender ; } for (int i=0;i<10;i++) { for (int j=1;j<10;j++) { if (a[i].gpa<a[j].gpa) { a[i].gpa=a[j].gpa; } } } for (int i=0;i<10;i++) { cout<<a[i].gpa<<endl; } return 0; }
3 Answers
+ 8
In your line starting as std::cin >> a[i].id , you use << instead of >> for a[i].gpa and a[i].gender.
+ 8
But a thing you shouldn't do is use std:: if you use std's namespace.
+ 1
can you please put it in code playground and then post the code here



