Pupils' heights-Introduction to Computer Programming-Lab Assignment, Exercises of Computer Programming

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

2011/2012

Uploaded on 07/13/2012

ekbal
ekbal 🇮🇳

3.3

(4)

46 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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:
height
number of pupils
160
2
164
1
165
2
167
1
...
...
...
...
188
1
average height 174.0
Maximum Number of Students lies between 173 and 179
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.
docsity.com
pf2

Partial preview of the text

Download Pupils' heights-Introduction to Computer Programming-Lab Assignment and more Exercises Computer Programming in PDF only on Docsity!

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:

height number of pupils

average height 174.

Maximum Number of Students lies between 173 and 179

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.

docsity.com

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.

docsity.com