0% found this document useful (0 votes)
97 views2 pages

C++ Programming Assignment: Unique Characters & Competition Simulation

The document describes two programming questions. Question 1 asks to initialize a string, print unique characters from it in alphabetical order. Question 2 simulates a programming competition with multiple students answering true/false questions. It involves taking student answers as input, comparing to random answers, calculating scores and outputting the winner, runner up and average score. The output sample shows taking serial numbers and answers from 3 students as input and generating the required output.

Uploaded by

janay martin
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)
97 views2 pages

C++ Programming Assignment: Unique Characters & Competition Simulation

The document describes two programming questions. Question 1 asks to initialize a string, print unique characters from it in alphabetical order. Question 2 simulates a programming competition with multiple students answering true/false questions. It involves taking student answers as input, comparing to random answers, calculating scores and outputting the winner, runner up and average score. The output sample shows taking serial numbers and answers from 3 students as input and generating the required output.

Uploaded by

janay martin
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/ 2

Assignment 6

Deadline: Sat 23 jan 2021


Question # 1

Initialize a string of size 40. Write a program that prints all unique alphabets from string. After printing
them sort them in ascending order.
For example: Hi world I am here to help you.
Unique characters are: H, I, W, O, R, L, D, A, M, E, T, P, Y, U.
Sorted: A, D, E, H, I , L,M, O, P, R, T, U, W, Y

Question # 2

University of Central Punjab (UCP) is arranging a competition of programming, in which IT


department student can participate. In this competition student will be asked questions
(True/False) and student will be given points, in the end student whose points are higher will be
winner. Student whose marks are second highest is called runner up. 

You are required to simulate this scenario using C++.

● User will enter 3 options either True (T), False (F) or space for each question. As shown
below

T F T T F T T F T
The answer to question 1 is true, the answer to question 2 is False, and student did not
answer question 4. The exam has 10 questions.
● Each correct answer is awarded two points, each wrong answer gets one point
deducted, and no answer gets zero points.
● Assume there are 10 students so you have to ask 10 strings of True false as seen above.
Before entering answer ask user to write his/her serial number. So you have two array
one contain roll number and one contains marks of each student. This concept is called
parallel array. Note: please make sure using programming, that user should enter a
unique serial#, if it selects a previously available serial#, tell /her to enter again.
● Generate a random key that have correct answers in order to give students marks.
Tasks to be done:
Q1. Print winner and runner up serial# along with marks
Q2.Print all participants serial # and marks in descending order(parallel sorting)
Q3.Print average of marks of all students
Sample Output: (for 3 students)
F F T T T T T F T
Please enter your serial Number: 123
Please enter questions answers:

Please enter your serial Number: 123


Sorry this serial number is already present! Enter again: 453

T F F T T T T T F T
Please enter questions answers:

Please enter your serial Number: 143


F T F T F F F F F T
Please enter questions answers:

F T F T T T T T F T
Answers to questions are:

Winner student is: 123 with marks 18


Runner up is: 453 with marks 14

Marks of Students are:


123 18
453 14
143 8
Average of marks is: 13.333

You might also like