You are on page 1of 2

Assignment No.

02 Semester: Spring 2012 CS201: Introduction to Programming Instructions:

Total Marks: 20 Due Date:02/05/2012

Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if: The assignment is submitted after due date. The submitted assignment does not open or file is corrupt. Assignment is copied(partial or full) from any source (websites, forums, students, etc)

Note: You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted and will be awarded with zero marks. For example, if you submit code in .doc (Word document) or .txt files, no reward will be given in any case. Objective: The objective of this assignment is to provide hands on experience of: Functions Array Manipulation

Guidelines: Code should be properly indented and well commented. Follow C/C++ rules while writing variable names, function names etc Use only dev-C++ for this assignment. Use appropriate C/C++ structure i.e. if-else; switch statement etc to get inputs from user where required (Marks will be deducted if inappropriate structure will be used)..

Assignment

Problem Statement:

Temperature Calculation system

Write a program that displays average, highest and lowest temperatures. Detailed Description: The program will take temperature readings as input from user for specified number of consecutive days. Program will store these temperature values into an array. Then it will pass this array to three different functions. One function will return highest temperature, one will return lowest temperature and third one will return average temperature. All these functions will be called inside main() function where these temperature results will be displayed to the user.

Sample Output:
Enter the number of consecutive days to read their temperature : 5 Enter temperature for day 1: 50 Enter temperature for day 2: 80 Enter temperature for day 3: 30 Enter temperature for day 4: 92 Enter temperature for day 5: 47 The average temperature is 59.80 The highest temperature is 92.00 The lowest temperature is 30.00

NOTE:
The array containing temperature values must be passed to three different functions to return average, highest and lowest temperatures. Marks will be deducted if assignment is solved with some other technique.

You might also like