|
|
发表于 2008-7-3 17:34:00
|
显示全部楼层
Re: Re:面试失败,帮帮我吧!!!
小小C: Re:面试失败,帮帮我吧!!!
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
int in;
char *out[5] = {"不及格", "及格", "良好", "优秀", "超出范围"};
cout << "please enter you score: ";
cin >> in;
cout << endl;
int temp = in / 60;
int index = temp + temp * ( (in-60) / 15 );
cout << out[index] << endl;
return 0;
}
我输入 104分,
temp=104/60=1
index=temp+temp((104-60)/15)=1+1(44/15)=1+2=3
结果输出“优秀”!
104分=优秀!
[em11] |
|