初学,实在不知道哪错了
#include<iostream>
#include<string>
using namespace std;
int main()
{
int n=0;
int i;
cin >> n;
struct fun{
string name[10];
string xuehao[10];
int number;
} s,max,min;
min.number=100;
max.number=0;
for(i=0;i<n;i++){
cin >> s.name ; /*a.cpp:19:18: error: no match for ‘operator>>’ (operand types are ‘std::istream {aka std::basic_istream<char>}’ and ‘std::__cxx11::string [10] {aka std::__cxx11::basic_string<char> [10]}’)
std::cin >> s.name ;*/
cin>> s.xuehao;
cin>> s.number;
if(max.number<=s.number){
max.number=s.number;
max.name=s.name; /*a.cpp:24:16: error: invalid array assignmen max.name=s.name;*/
max.xuehao=s.xuehao;}
if(min.number>=s.number){
min.number=s.number;
min.name=s.name;
min.xuehao=s.xuehao;}
}
cout << max.name <<"" <<max.xuehao <<endl;
cout << min.name <<"" <<min.xuehao <<endl;
return 0;
}