Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created October 3, 2022 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/e818f94c86c8c929d4de46010bf3cfec to your computer and use it in GitHub Desktop.
Save codecademydev/e818f94c86c8c929d4de46010bf3cfec to your computer and use it in GitHub Desktop.
Codecademy export
#include <iostream>
int main() {
//dog age entered
int dog_age;
//First two years of a dog's life is 21 human years.
int early_years = 21;
//Each following year counts as 4 human years. Minus the first two years for the 21 years.
int later_years = (dog_age-2) * 4;
int human_years = early_years + later_years;
std::cout << "Enter your dog's age: \n";
std::cin >> dog_age;
std::cout << "My name is Luna! Ruff ruff, I am " << human_years << " years old in human years.\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment