Skip to content

Commit 9c76bfc

Browse files
authored
Create 12_cat_years.cpp
1 parent b1ba06a commit 9c76bfc

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

2-variables/12_cat_years.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Cat Years 🐈
2+
3+
#include <iostream>
4+
5+
int main() {
6+
int catAge;
7+
8+
std::cout << "Welcome to the Cat Years program! This only works for cats older than 3 years old.\n";
9+
std::cout << "Enter your cat's age: ";
10+
std::cin >> catAge;
11+
12+
int humanYears = (catAge - 2) * 4 + 24;
13+
std::cout << "Your cat is " << humanYears << " years old in human years.";
14+
}

0 commit comments

Comments
 (0)