2008年12月14日 星期日

c++

#include
using namespace std;

int main()
{
int s,sum=0,count=0,good=0;
while(true){
cout << "請輸入程設分數:";
cin >> s;
if (s==0)
break;
sum+=s;
count++;
if ( s>=60 )
good++;
}
cout<<"你共輸入"<< count <<"位成績平均分數為"<< sum/count;
cout<< good <<"及格"<< count-good <<"不及格";