设计评选优秀教师和优秀学生候选人的程序。如果学生的分数大于 90,则可评为优秀生;如果教师发表的论文数大于 3,则可评为优秀教师
#include <iostream>
using namespace std;
int main()
{
int score, publication;
cout << "请输入学生的分数:";
cin >> score;
cout << "请输入教师的发表论文数:";
cin >> publication;
if (score > 90) {
cout << "该学生是优秀候选人" << endl;
}
else {
cout << "该学生不是优秀候选人" << endl;
}
if (publication > 3) {
cout << "该教师是优秀候选人" << endl;
}
else {
cout << "该教师不是优秀候选人" << endl;
}
return 0;
}
不知道你这个问题是否已经解决, 如果还没有解决的话:#include<stdio.h>
int main()
{
int age(int n);
printf("no.5,age:%d\n",age(5));
return 0;
}
int age(int n)
{
int c;
if(n==1)
c=10;
else
c=age(n-1)+2;
return (c);
}