Write a fuel consumption calculator that can convert in either direction between miles-per-gallon and liters-per-100km.
For example, a car that can drive 34 miles on one (US) gallon of fuel will consume 6.92 liters of fuel if it is driven 100km.
Feel free to use QInputDialog and QMessageBox as demonstrated in Section 1.11.
Ask the user for a birthdate, and calculate her current age. Hints: use QInputDialog::getText()
,
convert result from QString to QDate, and compare to QDate::currentDate()
.
Alternately, you can create a dialog that presents a QDateEdit
to get a proper date from the user.
[ fromfile: qtintro.xml id: None ]
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |