Professional Documents
Culture Documents
Fall 2021-2022
Ayan Tabassum
Lab Guidelines
1. You are allowed to perform/submit the lab only during the lab timings
2. Make sure you do not leave the lab without submitting your work on LMS
3. Copying/sharing code is strictly prohibited. Using any unfair means will lead to immediate
disqualification
4. Put all cpp files into a folder YourRollNo_Lab3_TAname and submit it on LMS
(Assignments>Lab3)
5. Lab ends at 8:50 pm and the submission tab closes at the same time
Task1 Total
20
Task2 Total
30
Task3 Total
30
Write a program that asks for this class’s course code in the form of two letters and
three integers, and shows the course code.
It then asks for the number of instructors, teaching assistants and students in this
section, and shows the total number of people in the section.
Finally, it asks for your expected CGPA and shows that you’ll hopefully get it.
Sample output:
*****************************
Your course is: CS100
*****************************
*****************************
Total number of people in the roster are: 101
*****************************
Hopefully you will get your CGPA of 3.8 at the end of this year!
__________________________________________________________________
*****************************
Each child gets 4 candies
There are 14 candies left.
Total amount spent on candies: PKR 1568
Amount lost due to candies that are left: PKR 224
*****************************
________________________________________________________________
The quadratic formula is a widely used formula that is used to find the roots of a
quadratic equation.
Write a program that takes input the values of a, b and c. It then finds both of the roots
of the quadratic equation and stores them in variables root1 and root2, and displays
them accordingly.
<Hint1: In root1, write the formula with only the plus sign ‘-b + sqrt(....)...’. In root2, write
the formula with only the minus sign ‘-b - sqrt(....)...’.>
<Hint2: Find the square root by using the sqrt function , e.g ‘sqrt(4)’ outputs 2. Include
the ‘cmath’ library>