diff --git a/Lab01_#1.cpp b/Lab01_#1.cpp new file mode 100644 index 0000000..62d02d7 --- /dev/null +++ b/Lab01_#1.cpp @@ -0,0 +1,22 @@ +// ConsoleApplication7.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" +#include +#include +using namespace std; +int main() +{ + string food1 = ""; + string food2 = ""; + + cout << "What is one of your favorite foods? "; + cin >> food1; + cout << "What is another one of your favorite foods? "; + cin >> food2; + cout << "Your new favorite food is " << food1 << food2 << endl; + + getchar(); + getchar(); + return 0; +} diff --git a/Lab01_#2.cpp b/Lab01_#2.cpp new file mode 100644 index 0000000..563d13d --- /dev/null +++ b/Lab01_#2.cpp @@ -0,0 +1,27 @@ +// ConsoleApplication8.cpp : Defines the entry point for the console application. +// +/***************************************************** +* Problem2.cpp * +* Author: Sam Coon * +* Date: 1/20/15 * +*****************************************************/ +#include "stdafx.h" +#include +using namespace std; +int main() +{ + double bill = 0.0; + double tip = 0.0; + float percent = .15; + + cout << "\tWelcome to tip calculator!" << endl; + cout << "Enter the cost of the bill: "; + cin >> bill; + tip = bill*percent; + cout << "Your tip should be $" << tip << endl; + + getchar(); + getchar(); + return 0; +} + diff --git a/Lab01_#3.cpp b/Lab01_#3.cpp new file mode 100644 index 0000000..4693211 --- /dev/null +++ b/Lab01_#3.cpp @@ -0,0 +1,33 @@ +// ConsoleApplication9.cpp : Defines the entry point for the console application. +// +/************************************** +* Problem3.cpp * +* Author: Sam Coon * +* Date: 1/21/15 * +**************************************/ + +#include "stdafx.h" +#include +using namespace std; +int main() +{ + double total = 0.0; + double car = 0.0; + double tax = 0.0; + double liscense = 0.0; + int dealerPrep = 300; + int locationCharge = 200; + + cout << "\tCar Salesman Program" << endl; + cout << "Enter the price of the car you want: "; + cin >> car; + tax = .15 * car; + liscense = .2 * car; + total = car + tax + liscense + dealerPrep + locationCharge; + cout << "The total of the car after all additional fees is $" << total << endl; + + getchar(); + getchar(); + return 0; +} + diff --git a/Lab01_#4.cpp b/Lab01_#4.cpp new file mode 100644 index 0000000..e07abe8 --- /dev/null +++ b/Lab01_#4.cpp @@ -0,0 +1,42 @@ +// ConsoleApplication10.cpp : Defines the entry point for the console application. +// +/********************************************************************** +* Problem4.cpp * +* Author: Sam Coon * +* Date: 1/21/15 * +* Include iostream, stdlib.h, and time.h * +* using namespace std * +* int main() * +* Set number to a random number 1-5 * +* set up an if statement with a different fortune for every number * +**********************************************************************/ +#include "stdafx.h" +#include +#include "stdlib.h" +#include "time.h" +using namespace std; +int main() +{ + srand(time(0)); + int number = rand() % 5 + 1; + + if(number == 1){ + cout << "You will fall down the stairs soon." << endl; + } + else if(number == 2){ + cout << "You will run into a door today." << endl; + } + else if(number == 3){ + cout << "You will come across some money today." << endl; + } + else if(number == 4){ + cout << "The cake is a lie." << endl; + } + else if (number == 5){ + cout << "Be careful where you go." << endl; + } + + getchar(); + return 0; +} +