0% found this document useful (0 votes)
49 views3 pages

Task 01: Write A C++ Program That Input A Number From User and Find Whether The Entered Number Is An Integer or Float

The document contains 9 tasks related to writing C++ programs to perform various calculations based on user input. Task 1 asks to write a program that takes a real number as input and outputs its absolute value. Task 2 checks if a number is an integer or float. Task 3 finds the largest of two input numbers. Task 4 compares two integers. Task 5 modifies Task 4 to handle equal numbers. Tasks 6-9 involve calculating salaries, fares, scholarships based on criteria like hours worked, age, GPA.

Uploaded by

prince12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views3 pages

Task 01: Write A C++ Program That Input A Number From User and Find Whether The Entered Number Is An Integer or Float

The document contains 9 tasks related to writing C++ programs to perform various calculations based on user input. Task 1 asks to write a program that takes a real number as input and outputs its absolute value. Task 2 checks if a number is an integer or float. Task 3 finds the largest of two input numbers. Task 4 compares two integers. Task 5 modifies Task 4 to handle equal numbers. Tasks 6-9 involve calculating salaries, fares, scholarships based on criteria like hours worked, age, GPA.

Uploaded by

prince12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Task 01

The magnitude of a real number without regard to its sign is called its Absolute Value.
For Example, absolute value of -965 is 965, absolute value of 986 is 986.
You are required to write a code which will take input a Real Number from user and
will output its absolute value.
Whenever taking input from user or showing an output to user, try to use meaningful
prompts.

Task 02
Write a C++ program that input a number from user and find whether the entered
number is an integer or float.
Input Input Input
295 1.6 0.99
Output Output Output
The Number is an Integer. The Number is Float. The Number is Float.

Task 03
Write a code which will input two numbers from user and output the largest
number.
Input Input Input
2,9 19 , 3 -9 , -11
Output Output Output
The Largest Number is 9. The Largest Number is 19. The Largest Number is -9.

Task 04
Input two integers from user and output which number is greater than other.
Input Input Input
2,9 19 , 3 -9 , -11
Output Output Output
9 is Greater than 2. 19 is Greater than 3 -9 is Greater than -11
Task 05
Modify the program written in previous question to handle the equal integers also.
Input Input Input
99 , -1 27 , 27 -97 , -97
Output Output Output
99 is Greater than 1. Both Numbers are Equal. Both Numbers are Equal.

Task 06
Chief Minister Punjab Wanted to complete the Orange Line Project as early as possible.
To make this dream come true, workers need to be work day and night. So CM
announced an overtime package for the labor, the labor will be paid double the wage
amount if it worked more than 8 hours. Can you help the accountant to make salaries of
the labor by each day end?
You are required to write a program which will input per hour wage, number of
hours worked and will output its salary for that day.

Task 07
Pakistan Railway is planning to automate its fare calculation for tickets. There are
following facilities given in Fare based on age.
There is no Fare for travel for the Children of age below 3.
There is 50% Fare Concession for the Children of age between 3 to 10.
There is Half fare for the senior citizen for the age of 65 or above.
Write a C++ program that input age of passenger and Fare and outputs the discounted
fare based on the criteria explained above.
Task 08
Here is the Scholarship Criteria in UCP

Scholarship GPA Requirement

100% of the Fee >=3.95

75% of the Fee >=3.90, <3.95

50% of the Fee >=3.50, <3.90

25% of the Fee >=3.25, <3.50

12.5% of the Fee >=3.00, <3.25

0% of the Fee <3.00

You are required to ask student’s GPA and tell him that how much Scholarship he/she
will get.

Task 09
Based on the criteria of scholarship in previous question. Now ask for the Tuition Fee
and GPA and tell about the Tuition fee he needs to submit.
Input Input
GPA : 3.91 GPA : 3.69
Tution Fee : 150000 Tution Fee : 125000
Output Output
You Need to Pay Rs.37500 Only. You Need to Pay Rs.93750 Only.

You might also like