diff options
Diffstat (limited to 'CST116F2021-Lab3/CST116F2021-Lab3.cpp')
| -rw-r--r-- | CST116F2021-Lab3/CST116F2021-Lab3.cpp | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/CST116F2021-Lab3/CST116F2021-Lab3.cpp b/CST116F2021-Lab3/CST116F2021-Lab3.cpp index 73af6ad..de2eaba 100644 --- a/CST116F2021-Lab3/CST116F2021-Lab3.cpp +++ b/CST116F2021-Lab3/CST116F2021-Lab3.cpp @@ -6,35 +6,40 @@ using namespace std; int main() { - int fib = 1; - int temp1 = 1; - int temp2 = 0; - int MAX; + int numAssignments; + int avgNum = 0; + int Assignment; - cout << "Enter MAX Fibbonachi number: "; - cin >> MAX; + cout << "Please enter the number of assignments in the class: "; + cin >> numAssignments; - if (MAX != 0) { - cout << fib << endl; - } - else { + if (numAssignments > 0) { + + for (int i = 0; i < numAssignments; i++) { + cout << "Please enter assignment score: "; + cin >> Assignment; + avgNum += Assignment; - cout << "0 WAS ENTERED. ENTER A DIFFERENT NUMBER FOR A SEQUENCE."; + + } + cout << endl; + cout << "The average of the assignments is: "; + cout << (float)avgNum / numAssignments; } - while (fib < MAX) - { - cout << fib << endl; - temp2 = fib; - fib = fib + temp1; - temp1 = temp2; + else { + + cout << "Insufficient number of assignments"; } + } + + //int a = 0; //cout << a++ << endl; //cout << ++a << endl; |