Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Lab01_1.cpp
Original file line number Diff line number Diff line change
@@ -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 <iostream>
#include <string>
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();
}

35 changes: 35 additions & 0 deletions Lab01_2.cpp
Original file line number Diff line number Diff line change
@@ -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 <iostream>
#include <string>
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;
}

35 changes: 35 additions & 0 deletions Lab01_3.cpp
Original file line number Diff line number Diff line change
@@ -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 <iostream>
#include <string>
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;
}

43 changes: 43 additions & 0 deletions Lab01_4.cpp
Original file line number Diff line number Diff line change
@@ -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 <iostream>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
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;
}