Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Study the codebelow to answer the question that follows: #include #Include #include #include int computeAge ( QDate id ) { int years = QDate::currentDate (
Study the codebelow to answer the question that follows:
#include
#Include
#include
#include
int computeAge QDate id
int years QDate::currentDate year idyear ;
int days QDate::currentDate daysTo QDate QDate: :currentDate year idmonth, idday ;
ifdays
years ;
return years;
int mainint argc, char argv
QApplication a argc argv;
include your code here
return aexec;
The function computeAge given above calculates the current age of a
person using hisher date of birth provided in the QDate input parameter.
Complete the main function so that it uses a QInputDialog to get a birthdate from the user in the format ddmmyyyy and displays the age using a MessageBox.
Note:
you need to indicate to the user the expected format of the birth date in the QInputDialog
you do not have to include code for input validation
make use of computeAge to calculate the age
toInt is a member function of String that converts a string to an int
you need to only write down the missing lines of code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started