diff options
Diffstat (limited to '6a/8.4Execrcies6a/8.4Execrcies6a.cpp')
| -rw-r--r-- | 6a/8.4Execrcies6a/8.4Execrcies6a.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/6a/8.4Execrcies6a/8.4Execrcies6a.cpp b/6a/8.4Execrcies6a/8.4Execrcies6a.cpp new file mode 100644 index 0000000..70751a3 --- /dev/null +++ b/6a/8.4Execrcies6a/8.4Execrcies6a.cpp @@ -0,0 +1,29 @@ +// 8.4Execrcies6a.cpp : This file contains the 'main' function. Program execution begins and ends there. +// + +#include <iostream> +using namespace std; + +int main() +{ + int amount = 1; + double totalScore = 0, avg; + + cout << "Input the number of assignments: "; + cin >> amount; + + for (int i = 1; i <= amount; i++) { + cout << "Input the next score: "; + double score; + cin >> score; + totalScore += score; + } + + if (amount < 1) { + amount = 1; + } + + avg = totalScore / amount; + cout << "The average score is " << avg << "."; + +} |