Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
