

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Kusum Megana assigned this task in lab of Introduction to Computer Programming course at Biju Patnaik University of Technology, Rourkela. It includes: Pupils, Heights, Statistics, Average, C , Program, Individual, Smallest, Number, User
Typology: Exercises
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Computer Programming: Assignment and Lab Work
Q1. Pupils' heights
The health visitor at a school is going to measure the heights of all pupils. For each class she makes a statistics giving the number of pupils of each height and the average height.
Make a C++ program that helps the health visitor making the statistics.
Example:
In a class with 20 pupils the heights of the individual pupils, in centimeters, are:
175, 167, 160, 164, 183, 187, 188, 179, 176, 175, 169, 175, 176, 178, 165, 160, 173, 165, 187, 178
The program should read in all the numbers and make a table like this:
Q2. Find the nth smallest number in an unsorted array of numbers. Write a C++ Program. Hint [14 is 3rd smallest number is this array {25,14,10,5,50,30} ]..Hint: First sort the array
Q3. Write a c++ program that finds square root of number?
Q4. Set theory: Write a C++ program that declare/initialize two integer arrays A and B of size 10. You program takes input values from user. Initialize an integer array U of size 50 with first fifty positive integers. Your program provides following functionality to user.
Press N or n for A intersection B Press U or u for A Union B Press / for A / B Press \ for B / A Press A or a for A’s Complement Press B or b for B’s Complement Press D to prove De Morgan’s Law
You program continues until user want to quit. Output of your programs should be in set representations i.e. A union B = {2, 4, 34, 20} OR A’s Complement = {45, 34, 22}. In case of De Morgan’s Law compute intersection or Union first and then apply complement.