CSE202Lab7

CSE202Lab7 - functions will be called from main and then...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 202 Lab 7 Instructions: Do not submit anything electronically! Make sure that you are saving the source codes as different names so you don’t overwrite your previous work. If your programs ever get stuck in an infinite loop, press control + c to stop the program. Turn in a printout of your source code. 1. Definition: Given n numbers n1,n2,n3,n4 …… nn then, Sum = n1 + n2 + n3 + n4 + …. + nn. Average = Sum / n. Standard Devation = sqrt {[(|n1 – Average|)^2 + (|n2 – Average|)^2 + …. + (|nn – Average|)^2] / n } 2. Program: Write 3 functions who calculate the sum, average and standard deviation of 5 numbers. The numbers are taken in the main function form the user and then your created
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: functions will be called from main( ) and then the results will be returned by your functions which will be printed in main( ) . Int Sum(int a, int b, int c, int d, int e) { //your code here } Int Average(int sum) { //your code here } Int StandardDeviation(int a, int b, int c, int d, int e, int avg) { //your code here } Note: Because the functions calculate and return the result, I do not want any function to contain cin or cout statements. Do these within main(). 3. Extra Credit: Q. Can you use an array for n numbers instead of 5 numbers???? If Yes, Write A Code that uses arrays for numbers. If No, Explain Why?...
View Full Document

This note was uploaded on 10/18/2009 for the course CSE 201 taught by Professor All during the Spring '09 term at Ohio State.

Ask a homework question - tutors are online