Skip to content

Commit

Permalink
Merge pull request #5 from ericgfx/patch-1
Browse files Browse the repository at this point in the history
Create snoop_dog
  • Loading branch information
Sonny Li authored Mar 26, 2019
2 parents 83575b5 + 0a4aa9a commit dde8df9
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions 2-variables/dog-years/snoop_dog
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";

}

0 comments on commit dde8df9

Please sign in to comment.