diff --git a/Lab01_1.cpp b/Lab01_1.cpp new file mode 100644 index 0000000..341887f --- /dev/null +++ b/Lab01_1.cpp @@ -0,0 +1,29 @@ +/***************** +* CPP_Lab_01 * +* Challenge 1 * +****************** +* Have user enter two * +* of their favorite foods,* +* set each to favFood1/2 * +* respectfully.. * +* Print out the foods on * +* the same line conjoined * +**************************/ +#include "stdafx.h" +#include +#include +using namespace std; +int main() +{ + string favFood1 = ""; + string favFood2 = ""; + cout << "Enter your first favorite food:" << endl; + cin >> favFood1; + cout << endl << "Enter your second favorite food:" << endl; + cin >> favFood2; + cout << endl; + cout << "Your dream meal is " << favFood1 << " " << favFood2 << endl; + cin.ignore(); + cin.ignore(); +} + diff --git a/Lab01_2.cpp b/Lab01_2.cpp new file mode 100644 index 0000000..133200f --- /dev/null +++ b/Lab01_2.cpp @@ -0,0 +1,35 @@ +/*************** +* Cpp_Lab_01 * +* Lab01_2 * +**************** +* Take in a float * +* amount entered by * +* the user, set to * +* 'bill' * +* Calculate tips, * +* Set to tip15/20 * +* respectfully * +* Print results * +********************/ + +#include "stdafx.h" +#include +#include +using namespace std; +int main() +{ + float bill = 0; + float tip15 = 0; + float tip20 = 0; + cout << "Enter your bill amount: "; + cin >> bill; + cout << endl; + tip15 = (bill * .15); + tip20 = (bill * .20); + cout << "Your tip at 15% is: $" << tip15 << endl; + cout << "Your tip at 20% is: $" << tip20 << endl; + cin.ignore(); + cin.ignore(); + return 0; +} + diff --git a/Lab01_3.cpp b/Lab01_3.cpp new file mode 100644 index 0000000..85fd590 --- /dev/null +++ b/Lab01_3.cpp @@ -0,0 +1,35 @@ +/**************** +* Cpp_Lab_01 * +* Lab01_03 * +***************** +* Have user enter base price * +* Then using basePrice, * +* calculate tax & licensing * +* Set dealer prep and dest. * +* to a set amount. * +* Add all amounts up, set to * +* totalPrice, print result */ + +#include "stdafx.h" +#include +#include +using namespace std; +int main() +{ + float basePrice = 0.0; + cout << "Enter the base price: "; + cin >> basePrice; + cout << endl; + float tax = 0.0; + tax = (basePrice * .15); + float license = 0.0; + license = (basePrice * 0.075); + float dealerPrep = 100.50; + float destination = 200.65; + float totalPrice = (basePrice + tax + license + dealerPrep + destination); + cout << "Ending total: $$" << totalPrice << endl; + cin.ignore(); + cin.ignore(); + return 0; +} + diff --git a/Lab01_4.cpp b/Lab01_4.cpp new file mode 100644 index 0000000..d99f293 --- /dev/null +++ b/Lab01_4.cpp @@ -0,0 +1,43 @@ +/********************* +* Cpp_Lab_01 * +* Lab01_4 * +********************** +* generate a random * +* number, set to * +* 'num', then use * +* 'if' statements * +* to correspond each * +* possible number to * +* a specific fortune * +*********************/ +#include "stdafx.h" +#include +#include +#include +#include +#include +using namespace std; +int main() +{ + int num = 0; + srand (time(NULL)); + num = rand() % 5 + 1; + if (num == 1){ + cout << "You will live a fulfilling life:D"; + } + else if (num == 2){ + cout << "A bear will be your ultimite demise:("; + } + else if (num == 3){ + cout << "Keep playing the lottery, and you will eventually win:D"; + } + else if (num == 4){ + cout << "You will get violent diarhea from this..awkward."; + } + else if (num == 5){ + cout << "You paid extra for the 'free' eggroll>:D"; + } + getchar(); + return 0; +} +