-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sonny Li
committed
Mar 26, 2019
1 parent
dde8df9
commit af18711
Showing
1 changed file
with
15 additions
and
15 deletions.
There are no files selected for viewing
30 changes: 15 additions & 15 deletions
30
2-variables/dog-years/snoop_dog → 2-variables/dog-years/snoop_dog.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
#include <iostream> | ||
|
||
int main() { | ||
//Allow user to enter dog's name | ||
|
||
// Allow user to enter dog's name | ||
std::string dog_name; | ||
std::cout << "Enter your dog's name: "; | ||
std::cin >> dog_name; | ||
//Allow user to enter dog's age with decimal | ||
|
||
// Allow user to enter dog's age with decimal | ||
double dog_age; | ||
std::cout << "Enter dog's Age: "; | ||
std::cout << "Enter your dog's age: "; | ||
std::cin >> dog_age; | ||
|
||
|
||
double early_years, later_years, human_years; | ||
//first two years | ||
|
||
// First two years | ||
early_years = 21; | ||
|
||
//accounts for later years | ||
// Accounts for later years | ||
later_years = (dog_age - 2 ) * 4; | ||
|
||
//my logic for puppy math | ||
if (dog_age < 2){ | ||
// My logic for puppy math | ||
if (dog_age < 2) { | ||
early_years = (early_years / 2) * dog_age; | ||
later_years = 0; | ||
} | ||
|
||
human_years = later_years + early_years; | ||
|
||
std::cout << "\nMy name is " << dog_name << "! Ruff ruff, I am " << human_years << " years old in human years.\n\n Bow wow wow, yippie yo.\n"; | ||
|
||
|
||
std::cout << "\nMy name is " << dog_name << "! Ruff ruff, I am " << human_years << " years old in human years.\n"; | ||
std::cout << "Bow wow wow yippie yo yippie yay\n"; | ||
|
||
} |