diff options
| author | till-t <[email protected]> | 2021-10-19 16:52:22 -0700 |
|---|---|---|
| committer | till-t <[email protected]> | 2021-10-19 16:52:22 -0700 |
| commit | 1f0d38c3c10604d16d6d31be136a5e3f501b9387 (patch) | |
| tree | 6ec69cd1f0cf4d989341803b5467fca18187ce95 | |
| parent | Updated lab 3 (diff) | |
| download | cst116-lab3-till-t-1f0d38c3c10604d16d6d31be136a5e3f501b9387.tar.xz cst116-lab3-till-t-1f0d38c3c10604d16d6d31be136a5e3f501b9387.zip | |
Completed Lab 3
| -rw-r--r-- | Lab3_Tyler.txt | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/Lab3_Tyler.txt b/Lab3_Tyler.txt index 0caf4a2..2c5ab0b 100644 --- a/Lab3_Tyler.txt +++ b/Lab3_Tyler.txt @@ -82,6 +82,20 @@ int main() { return 0; } +RUN: + Student Grade Program + - Main Menu - +1. Enter Name +2. Enter test scores +3. Display test scores +9. Exit +Please enter your choice from the list above: 1 +You chose to Enter your name. + +C:\Users\Till\source\repos\hw_practice\Debug\hw_practice.exe (process 7824) exited with code 0. +Press any key to close this window . . . + + 5C) @@ -166,6 +180,17 @@ int main() return 0; } +RUN: +Please enter a loan amount request: 500 +Please enter an interest rate: 5 +Interest paid on this loan is: $25 +Requested Loan: $500 +Interest rate: 5% +Total cost including all fees for this loan will be: $545 + +C:\Users\Till\source\repos\hw_practice\Debug\hw_practice.exe (process 14452) exited with code 0. +Press any key to close this window . . . + @@ -265,5 +290,106 @@ int main() return 0; } +RUN: +Enter a number between 1 and 50: 25 +25 +24 +22 +20 +18 +16 +14 +12 +10 +8 +6 +4 +2 +0 + +C:\Users\Till\source\repos\hw_practice\Debug\hw_practice.exe (process 21168) exited with code 0. +Press any key to close this window . . . + ------------------------------------------------------------------------------------------------------------- 8.4 Learn by doing exercise Pg. 184 #1 + + +#include <iostream> +#include <iomanip> + +using namespace std; + +int main() +{ + int num_assignments, ctr; + float score, avg, score_total = 0.0; + + cout << "Please enter the total number of assignments: "; + cin >> num_assignments; + ctr = num_assignments; + + for (ctr; ctr > 0; ctr--) + { + cout << "Please enter score: "; + cin >> score; + score_total += score; + } + avg = score_total / num_assignments; + + cout << "Your Average score for assignments is: " << avg << endl; + + return 0; +} + +RUN: +Please enter the total number of assignments: 5 +Please enter score: 10 +Please enter score: 9 +Please enter score: 9 +Please enter score: 10 +Please enter score: 10 +Your Average score for assignments is: 9.6 + +C:\Users\Till\source\repos\hw_practice\Debug\hw_practice.exe (process 21132) exited with code 0. +Press any key to close this window . . . + +------------------------------------------------------------------------------------------------------------------------------ + +8.10 Programming Exercises Pg 192 #3 FIBONACCI SEQUENCE + +#include <iostream> + +using namespace std; + +int main() +{ + int limit, term1 = 0, term2 = 1, nextTerm = 0; + + cout << "Enter the limit for the fibonacci sequence: "; + cin >> limit; + + cout << "Fibonacci Sequence: " << term1 << ", " << term2 << ", "; + + nextTerm = term1 + term2; + + while (nextTerm <= limit) { + cout << nextTerm << ", "; + term1 = term2; + term2 = nextTerm; + nextTerm = term1 + term2; + } + + return 0; +} + +RUN: + +Enter the limit for the fibonacci sequence: 26 +Fibonacci Sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, +C:\Users\Till\source\repos\hw_practice\Debug\hw_practice.exe (process 19324) exited with code 0. +Press any key to close this window . . . + + + + + |