CS 100 Lab 6 Tasks
CS 100 Lab 6 Tasks
CS 100 Lab 6 Tasks
Fall 2021-2022
Saood Ahmad
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_Lab6_TAname and submit it on LMS
(Assignments>Lab4)
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 in C++ to find the sum of the series 1 + 1/2^2 + 1/3^3 + ……. + 1/n^n.
Where the value of n is entered by the user.
You are only allowed to use While or Do-While loops
Sample Output:
1/1^1 = 1
1/2^2 = 0.25
1/3^3 = 0.037037
1/4^4 = 0.00390625
1/5^5 = 0.00032
The sum of the above series is: 1.29126
Write a program that asks the user relevant questions in order to guess one of the
four-sided shapes given. Phrase all questions such that the user should only answer in
terms of “YES” or “NO.” The program should not terminate after running once, but
instead should ask the user if they want to check another shape. (Hint: a Do - while
loop can be used here)
Sample output:
It is a rhombus!
It is a square!
“Good bye”
The following table contains the courses and grades obtained in those courses by 3
students. Write a program that takes in the name of a student, then asks you to input
one of the 3 courses (CS100, CS200, CS225), and then outputs the grade of the
student in that course.
Name Course Obtained Grade
Mukeet CS100 A
Mukeet CS200 A-
Mukeet CS225 B+
Esha CS100 A*
Esha CS200 B
Esha CS225 B+
Emaan CS100 B-
Emaan CS200 A*
Emaan CS225 A*
Sample Output: