diff options
Diffstat (limited to 'CST116F2021-Lab3')
| -rw-r--r-- | CST116F2021-Lab3/CST116F2021-Lab3.cpp | 20 | ||||
| -rw-r--r-- | CST116F2021-Lab3/CST116F2021-Lab3.vcxproj | 2 | ||||
| -rw-r--r-- | CST116F2021-Lab3/CST116F2021-Lab3.vcxproj.filters | 2 | ||||
| -rw-r--r-- | CST116F2021-Lab3/Joseph Ten Eyck-Lab3.cpp | 312 |
4 files changed, 314 insertions, 22 deletions
diff --git a/CST116F2021-Lab3/CST116F2021-Lab3.cpp b/CST116F2021-Lab3/CST116F2021-Lab3.cpp deleted file mode 100644 index 41af613..0000000 --- a/CST116F2021-Lab3/CST116F2021-Lab3.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// CST116F2021-Lab3.cpp : This file contains the 'main' function. Program execution begins and ends there. -// - -#include <iostream> - -int main() -{ - std::cout << "Hello World!\n"; -} - -// Run program: Ctrl + F5 or Debug > Start Without Debugging menu -// Debug program: F5 or Debug > Start Debugging menu - -// Tips for Getting Started: -// 1. Use the Solution Explorer window to add/manage files -// 2. Use the Team Explorer window to connect to source control -// 3. Use the Output window to see build output and other messages -// 4. Use the Error List window to view errors -// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project -// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file diff --git a/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj b/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj index a706d70..c7035d7 100644 --- a/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj +++ b/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj @@ -139,7 +139,7 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="CST116F2021-Lab3.cpp" /> + <ClCompile Include="Joseph Ten Eyck-Lab3.cpp" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj.filters b/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj.filters index 1a7ae88..617df37 100644 --- a/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj.filters +++ b/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj.filters @@ -15,7 +15,7 @@ </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="CST116F2021-Lab3.cpp"> + <ClCompile Include="Joseph Ten Eyck-Lab3.cpp"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> diff --git a/CST116F2021-Lab3/Joseph Ten Eyck-Lab3.cpp b/CST116F2021-Lab3/Joseph Ten Eyck-Lab3.cpp new file mode 100644 index 0000000..3830faf --- /dev/null +++ b/CST116F2021-Lab3/Joseph Ten Eyck-Lab3.cpp @@ -0,0 +1,312 @@ +//====================================================== +//= CODE FOR PROBLEM #1 ON PAGE 161 IS BELOW = +//====================================================== +// +//#include <iostream> <iomanip> +// +//using std::cout; +//using std::cin; +//using std::endl; +// +//int main() +//{ +// short choice; +// +// cout << "\t\t\tStudent Grade Program"; +// cout << "\n\t\t\t - Main Menu -"; +// cout << "\n\n\t\t1. Enter Name"; +// cout << "\n\t\t2. Enter test scores"; +// cout << "\n\t\t3. Display test scores"; +// cout << "\n\t\t9. Exit"; +// cout << "\n\n\tPlease enter your choice from the list above: "; +// +// cin >> choice; +// +// switch (choice) +// { +// case 1: +// cout << "\n\tYou chose: Enter name" << endl; +// break; +// case 2: +// cout << "\n\tYou chose: Enter test scores" << endl; +// break; +// case 3: +// cout << "\n\tYou chose: Display test scores" << endl; +// break; +// case 9: +// cout << "\n\tYou chose: Exit" << endl; +// break; +// default: +// cout << "\n\tMenu choice does not exist" << endl; +// +// } +// +// return 0; +//} + + +//====================================================== +//= CODE FOR PROBLEM #2 ON PAGE 168 IS BELOW = +//====================================================== + +//#include <iostream> +// +//using std::cout; +//using std::cin; +//using std::endl; +// +//int main() +//{ +// +// float rate, +// loan_amount, +// interest_amount, +// interest_and_fees, +// total_cost; +// +// short fee = 0; +// +// +// cout << "\t\t =========================\n"; +// cout << "\t\t\t= Loan Calculator ="; +// cout << "\n\t\t =========================\n"; +// +// cout << "\n\n\t\tEnter loan amount: "; +// cin >> loan_amount; +// +// cout << "\n\t\tEnter loan rate percent: "; +// cin >> rate; +// +// +// if (rate < 1 || rate > 18) +// { +// cout << "\n\n\tERROR: Interest rate is not between 1% and 18%" << endl; +// } +// +// else if (loan_amount < 100 || loan_amount > 1000) +// { +// cout << "\n\n\tERROR: Loan amount is not between $100 and $1,000" << endl; +// } +// +// else +// { +// +// if (loan_amount <= 500) +// fee = 20; +// +// else +// fee = 25; +// +// +// interest_amount = loan_amount * rate * 0.01; +// +// interest_and_fees = interest_amount + fee; +// +// total_cost = loan_amount + interest_and_fees; +// +// +// cout << "\n\n\tRequested loan amount: $" << loan_amount; +// cout << "\n\tInterest rate: " << rate << "%"; +// cout << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; +// cout << "\n\tInterest amount: $" << interest_amount; +// cout << "\n\tFee: $" << fee; +// cout << "\n\n\tSum of interst and fees: $" << interest_and_fees; +// cout << "\n\n================================================================"; +// cout << "\n\tTotal Cost: $" << total_cost << "\n\n"; +// } +// +// +// return 0; +//} + + +//====================================================== +//= CODE FOR PROBLEM #1 ON PAGE 177 IS BELOW = +//====================================================== + +//#include <iostream> +// +//using std::cout; +//using std::cin; +//using std::endl; +// +//int main() +//{ +// +// int number = 0; +// +// cout << "\n\tEnter an integer between 1 and 50: "; +// cin >> number; +// +// cout << "\n"; +// +// if (number < 1 || number > 50) +// cout << "\nERROR: Number must be between 1 and 50\n\n"; +// +// else +// { +// cout << number << " "; +// +// while (number > 0) +// { +// --number; +// +// if (number % 2 == 0) +// cout << number << " "; +// +// else +// cout << " "; +// +// } +// cout << "\n\n" << endl; +// } +// +// return 0; +//} + + +//====================================================== +//= CODE FOR PROBLEM #1 ON PAGE 179 IS BELOW = +//====================================================== + +//#include <iostream> +// +//using std::cout; +//using std::cin; +//using std::endl; +// +//int main() +//{ +// int number = 0; +// +// cout << "\n\tEnter an integer between 1 and 50: "; +// cin >> number; +// +// cout << "\n"; +// +// +// do +// if (number < 1 || number > 50) +// { +// cout << "\n\nERROR: Number must be between 1 and 50\n"; +// +// cout << "\n\tEnter an integer betwen 1 and 50: "; +// cin >> number; +// +// cout << "\n"; +// } +// else +// cout << "\n\n"; +// while (number < 1 || number > 50); +// +// +// cout << number << " "; +// +// while (number > 0) +// { +// --number; +// +// if (number % 2 == 0) +// cout << number << " "; +// +// else +// cout << " "; +// +// } +// cout << "\n\n" << endl; +// +// return 0; +//} + + +//====================================================== +//= CODE FOR PROBLEM #1 ON PAGE 184 IS BELOW = +//====================================================== + +//#include <iostream> +// +//using std::cout; +//using std::cin; +//using std::endl; +// +//int main() +//{ +// +// int assignments = 0; +// int assignments_initial = 0; +// int sum = 0; +// +// cout << "\n\t\tEnter number of assignments: "; +// cin >> assignments; +// +// assignments_initial = assignments; +// +// cout << "\n\n"; +// +// for (assignments; assignments > 0; assignments--) +// { +// int score = 0; +// +// cout << "\tEnter assignment " << assignments << " score: "; +// cin >> score; +// +// cout << "\n"; +// +// sum += score; +// } +// +// float avg = (float)sum / (float)assignments_initial; +// +// cout << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; +// cout << "\n\t\tAverage assignment score: " << avg; +// cout << "\n\n" << endl; +// +// return 0; +//} + + +//====================================================== +//= CODE FOR PROBLEM #3 ON PAGE 192 IS BELOW = +//====================================================== + +//#include <iostream> +// +//using std::cout; +//using std::cin; +//using std::endl; +// +//int main() +//{ +// int ending_number = 0; +// int current_number = 1; +// int previous_number = 0; +// int hold = 0; +// +// cout << "\n\t\t=================================="; +// cout << "\n\t\t== Fibonacci sequence generator =="; +// cout << "\n\t\t=================================="; +// cout << "\n\n\t"; +// +// cout << "Enter ending number: "; +// cin >> ending_number; +// +// cout << "\n\n"; +// +// if (ending_number < 1) +// cout << "ERROR: Ending number must be 1 or greater"; +// +// else +// +// while (current_number <= ending_number) +// { +// cout << current_number << " "; +// +// hold = current_number; +// current_number += previous_number; +// previous_number = hold; +// } +// +// cout << endl; +// +// return 0; +//}
\ No newline at end of file |