问题及代码:
#include <iostream>
using namespace std;
void average(int ,int ,int );
void juage(int ,int ,int );
void average(int a,int b,int c)
{
int d;
d=(a+b+c)/3;
cout<<d<<endl;
}
void juage(int a,int b,int c)
{
if (a<60)
cout<<"Chinese"<<endl;
if(b<60)
cout<<"Math"<<endl;
if(c<60)
cout<<"English"<<endl;
if(a>=60 &&b>=60 &&c>=60)
cout<<"pass"<<endl;
}
int main()
{
int num,Chinese,Math,English;
cin>>num>>Chinese>>Math>>English;
cout<<"student:"<<num<<endl;
average(Chinese,Math,English);
juage(Chinese,Math,English);
}
运行结果: