-
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.
Merge pull request #5 from ericgfx/patch-1
Create snoop_dog
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <iostream> | ||
|
||
int main() { | ||
|
||
//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 | ||
double dog_age; | ||
std::cout << "Enter dog's Age: "; | ||
std::cin >> dog_age; | ||
|
||
|
||
double early_years, later_years, human_years; | ||
|
||
//first two years | ||
early_years = 21; | ||
|
||
//accounts for later years | ||
later_years = (dog_age - 2 ) * 4; | ||
|
||
//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"; | ||
|
||
} |