Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment submission #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions fix-code-0/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ using namespace std;
int main() {
const string name = "Jimmy";
const string school_name = "Big City High School";
const unsignedint age = 20;
const unsigned int age = 20;
const float gpa = 3.7;

cout << name << " is " << age << " and attends the " << school_name;
cout << ". they currently have a gpa of " << gpa;
cout << ". They currently have a gpa of " << gpa << endl;
}
4 changes: 2 additions & 2 deletions fix-code-1/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ int main() {
const float food_per_day_cost = 21.6;
const float num_days = 8;

const float trip_cost = flights_cost * num_flights + food_per_day_cost * num_days;
float trip_cost = flights_cost * num_flights + food_per_day_cost * num_days;
const float discount_flight_voucher = 15.7;
trip_cost = trip_cost - flight_voucher;
trip_cost = trip_cost - discount_flight_voucher;
cout << "The total cost of the trip including the vouchers will be $" << trip_cost << endl;
}
4 changes: 2 additions & 2 deletions fix-code-2/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using namespace std;
int main() {
const float gold_fish_food_weight_lbs = .4;
const float gold_fish_tank_size_liters = 10.4;
string const gold_fish_name = "carl";
const string gold_fish_name = "carl";

cout << "I own a goldfish named " << gold_fish_name << ". his tank is " << gold_fish_tank_size_liters << " liters big, and he eats " << gold_fish_food_weight_lbs << "pounds of food.";
cout << "I own a goldfish named " << gold_fish_name << ". His tank is " << gold_fish_tank_size_liters << " liters big, and he eats " << gold_fish_food_weight_lbs << " pounds of food." << endl;
}
4 changes: 2 additions & 2 deletions fix-code-3/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ using namespace std;
int main() {
const unsigned int jim_age = 32;
const unsigned int daphny_age = 28;
const unsigned int agg_difference = jim_age - daphny_age;
cout << "Daphny is " << age_difference << " years older then Jim.";
const int age_difference = jim_age - daphny_age;
cout << "Daphny is " << age_difference << " years older then Jim." << endl;
}
11 changes: 7 additions & 4 deletions invent-code-0/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ int main() {
original_float = 13.5;
cout << "Please enter a integer: ";
cin >> original;
int clone = original + 14;
int product = original * clone;
cout << "The product is: " << product;
const int clone = original + 14;
const int product = original * clone;
cout << "The product is: " << product << endl;
}

/*
Type | Name | Value | Size
------ | -------- | ------- | ------
| | |
int | original | 87 | 4
float | original_float| 13.5| 4
const int| clone | 101 | 4
const int| product| 8787 | 4
*/
15 changes: 15 additions & 0 deletions invent-code-1/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,20 @@
using namespace std;

int main() {
int number_1;
int number_2;
cout << "Please enter an interger: ";
cin >> number_1;
cout << "Please enter another integer: ";
cin >> number_2;

const int num_sum = number_1 + number_2;
const int num_product = number_1 * number_2;
const int num_quotient = number_1 / number_2;
const int num_difference = number_1 - number_2;

cout << "The sum is " << num_sum << ", the product is " << num_product << ", the quotient is " << num_quotient << ", and the difference is ";
cout << num_difference << " between these two numbers." << endl;

// Write code here.
}