Answered step by step
Verified Expert Solution
Link Copied!

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)- 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

sharing of non-material benefits such as time and affection;

Answered: 1 week ago