0% found this document useful (0 votes)
10 views

Umambac - Practice Exercise Programming

The document contains C++ code that asks the user to input their name, birth year, and current year, then calculates and outputs their age.

Uploaded by

Angelie Umambac
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Umambac - Practice Exercise Programming

The document contains C++ code that asks the user to input their name, birth year, and current year, then calculates and outputs their age.

Uploaded by

Angelie Umambac
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include<iostream>

using namespace std;

int main ()

string name;

int age, birthyear, currentyear;

cout<<"Enter your name:";

cin>>name;

cout<<"\nEnter the current year:";

cin>>currentyear;

cout<<"\nEnter your birth year:";

cin>>birthyear;

age=2021-2001;

cout<<"\nYour name is:"<<name;

cout<<"\nYour age is:"<<age;

return 0;

You might also like