diff options
| author | [email protected] <[email protected]> | 2021-10-19 21:50:47 -0700 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2021-10-19 21:50:47 -0700 |
| commit | 76f15bee0bc960b4250f17c47163a05f1c150f57 (patch) | |
| tree | 42b27157e5205ec6d572cbff3dac8cd3edb90463 | |
| parent | Add online IDE url (diff) | |
| download | cst116-lab3-rayyanansari03-76f15bee0bc960b4250f17c47163a05f1c150f57.tar.xz cst116-lab3-rayyanansari03-76f15bee0bc960b4250f17c47163a05f1c150f57.zip | |
Updated main
| -rw-r--r-- | CST116F2021-Lab3/CST116F2021-Lab3.cpp | 146 |
1 files changed, 144 insertions, 2 deletions
diff --git a/CST116F2021-Lab3/CST116F2021-Lab3.cpp b/CST116F2021-Lab3/CST116F2021-Lab3.cpp index 41af613..73af6ad 100644 --- a/CST116F2021-Lab3/CST116F2021-Lab3.cpp +++ b/CST116F2021-Lab3/CST116F2021-Lab3.cpp @@ -1,13 +1,155 @@ -// CST116F2021-Lab3.cpp : This file contains the 'main' function. Program execution begins and ends there. +// Lab3-Ansari.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include <iostream> +using namespace std; int main() { - std::cout << "Hello World!\n"; + int fib = 1; + int temp1 = 1; + int temp2 = 0; + int MAX; + + cout << "Enter MAX Fibbonachi number: "; + cin >> MAX; + + if (MAX != 0) { + cout << fib << endl; + } + else { + + cout << "0 WAS ENTERED. ENTER A DIFFERENT NUMBER FOR A SEQUENCE."; + + } + + while (fib < MAX) + { + cout << fib << endl; + temp2 = fib; + fib = fib + temp1; + temp1 = temp2; + + } + + } +//int a = 0; +//cout << a++ << endl; +//cout << ++a << endl; +//cout << a + 1 << endl; +//cout << a << endl; +//cout << --a << endl; + +/* + int money; + cout << "Please enter how much money is in your account: "; + cin >> money; + cout << endl; + int accnt_num; + cout << "Please enter how many types of accounts you own: "; + cin >> accnt_num; + cout << endl; + string level; + + if (money >= 25000) { + + level = "Platinum"; + + } + + else if (money >= 10000 && accnt_num == 2) { + + level = "Gold"; + } + + else if (money >= 10000 && accnt_num == 1) { + + level = "Silver"; + } + + else { + + level = "Copper"; + + } + + + cout << level; + + + + + + short guess; + + cout << "ENter a number between 0 and 4: "; + cin >> guess; + + switch (guess) + { + case 0: + cout << "Zero" << endl; + break; + case 1: + cout << "One" << endl; + break; + case 2: + cout << "Two" << endl; + break; + case 3: + cout << "Three" << endl; + break; + case 4: + cout << "Four" << endl; + break; + default: + cout << "Invalid guess entered."; + } + + + + + + +float loanAmount; + float interestRate; + float amountDue; + cout << "Enter requested loan amount: "; + cin >> loanAmount; + cout << endl; + cout << "Enter interest rate: "; + cin >> interestRate; + cout << endl; + amountDue = loanAmount * (interestRate / 100); + + if ((loanAmount >= 100 && loanAmount <= 1000) && (interestRate >= 1 && interestRate <= 18)) { + + if (loanAmount <= 500) { + + amountDue += 20; + cout << "Loan requested: " << loanAmount << ", Interest rate: " << interestRate << endl; + cout << "Total Amount over loan due: " << amountDue; + + } + else { + + amountDue += 25; + cout << "Loan requested: " << loanAmount << ", Interest rate: " << interestRate << endl; + cout << "Total Amount over loan due: " << amountDue; + } + + } + else { + + cout << "INVALID"; + + } + + +*/ + // Run program: Ctrl + F5 or Debug > Start Without Debugging menu // Debug program: F5 or Debug > Start Debugging menu |