本文章最後由 site-admin 於 2015-12-27 17:24 編輯 #include<windows.h>
#include<iostream>
using namespace std;
int main()
{
int grade;
int count=0;
int tatal=0;
int average;
cout<<"enter the grades for sumation."<<endl<<"enter the 'EOF' to end input"<<endl;
while(cin>>grade)
{
count++;
total+=grade;
}
average=total/count;
{
cout<<average<<endl;
}
system ("pause")
return 0;
}
我們老師要我們做出可以輸入三個數字
難後 ctrl+z 可以算出平均值
上面這是我打的
就是最基本的用main寫的
後面轉函式 void的寫法我也會了
但是還有第三種
用gradebook寫的(稱為類別寫法嗎??)
我看我們老師寫好像分成三個來寫
當時沒看清楚害我現在一頭霧水
我們用的軟體是Visual Studio 2008
這幾天對於c++有點初步了解
但還是讓人很頭痛
只好上網請求幫忙了
希望有人伸出援手