You are on page 1of 1

Introduction to Programming Electrical Engineering Department University of Engineering & Technology, Taxila Assignment #2

Question 1 Write a program which will be "menu driven". This means that after every completed operation by your program, the user is presented with a menu of options once again. EVERY menu will have a "Quit" option that will exit the user completely from your program. Create your menu options with brief but meaningful labels. The first option of your menu will allow the user to input data. Upon choosing this option, the user will be allowed to enter (your program will prompt for and read in) three positive integers less than or equal to 100. This option is to be allowed at any time. The second option of your menu will order the three numbers (if they exist). That is, upon choosing option #2, your program will return to the user a listing of the three inputs in ascending order. If no numbers exist then ask the user to first enter three numbers. The third option of your program will tell the user whether the three inputs (if they exist) will form the sides of a triangle. That is, your program is to determine whether or not the three input values can possibly be the three sides of a triangle. For instance, 3, 4, and 10 cannot be sides of a triangle because the longest side is greater than the sum of the other two sides (they don't satisfy the "triangle inequality"). Question 2 Your program will be a "quiz-er" for the user. That is, your program will present the user with a quiz of arithmetic problems. Each "play" of the quiz will be 10 questions. The user will initially be presented with a short menu of options on difficulty level. It could look something like this: DIFFICULTY LEVEL 1. Easy 2. Moderate 3. Advanced The difficulty levels determine the number of digits in the operands to be added or subtracted. Easy means only single digit numbers; moderate means double digit numbers; and advanced means 4-digit numbers. After the user picks the level they desire, your program presents problems that look like this: 45 + 9 = _ 34 - 88 = _ etc But for each problem presented, the user is given a chance to answer. If the answer is correct, another problem is presented. If the answer is wrong, the user is to be given one more chance at that problem. Once your program has moved on to the next problem, the correctness/incorrectness of the preceding problem is tallied. The number of correct and incorrect answer is to be presented at the termination of the quiz along with percentage correct.