Last active
December 7, 2017 12:01
-
-
Save hansen033/6729d1f385fa2026aeec2af09e386ae9 to your computer and use it in GitHub Desktop.
2017/11/23 幾分鐘前交的搞錯題目
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
int AL, men; | |
cout << "請輸入要算{幾個數}的平均數:\n"; | |
cin >> men; | |
int num[men]; | |
cout << "請輸入要算的" << men << "個數的平均數的數值(小數點會不見):\n"; | |
for( int t = 0 ; t < men ; t ++ ){ | |
cin >> num[t]; | |
} | |
for( int t = 0 ; t < men ; t ++ ){ | |
AL += num[t]; | |
} | |
cout << "\n這10個數的平均數是:" << AL / men; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment