Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- int main() {
- std::string name;
- int age;
- time_t t = time(NULL);
- tm* timePtr = localtime(&t);
- std::cout << "What is your name? \n";
- std::getline(std::cin, name);
- std::cout << "What is your age? \n";
- std::cin >> age;
- std::cout << "\nHello, " << name << "!" << std::endl;
- std::cout << "Born: " << timePtr->tm_year + 1900 - age << std::endl;
- std::cout << 100 - age << " years left until age 100" << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement