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)- id.year () ;
int days = QDate::currentDate (.daysTo (QDate (QDate: :currentDate ().year(), id.month, id.day |)) ;
if(days >0)
years --;
return years;
int main(int argc, char *argv [])
QApplication a (argc, argv);
* include your code here */
return a.exec();
The function computeAge given above calculates the current age of a
person using his/her 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 dd/mm/yyyy 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!