diff options
| author | [email protected] <[email protected]> | 2021-10-19 23:29:47 -0700 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2021-10-19 23:29:47 -0700 |
| commit | dece0536d375ad7155f0c7c9596e7b8a5de49022 (patch) | |
| tree | f7a783e78fe631d89f6441361f25610e51a88e01 /CST116F2021-Lab3/CST116F2021-Lab3.cpp | |
| parent | lab 3 answers (diff) | |
| download | cst116-lab3-rayyanansari03-master.tar.xz cst116-lab3-rayyanansari03-master.zip | |
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; |