All pastes #757308 Raw Edit

SupraFast

public cpp v1 · immutable
·published 2007-11-01 04:36 UTC
rendered paste body
#include <iostream.h>int findAvg(int ar[], int sizeOfAr);int main(){	int cs135[10];	cout << "Please tell me what each student got on the last exam.\n\n";	//This loop asks the user what his students grades are	//and then stores them into the array. The loop starts	//off with student #0 and goes up to 10.	for(int student = 0; student < 10; student++){		cout << "Student Number " << student << ": ";		cin >> cs135[student];	}	cout << "\nThe students got the following grades on the last exam...\n\n";	//This loop displays the results that you typed in for each student.	//The loop starts off with studend #0 and goes up to 10.	for(student = 0; student < 10; student++)		cout << "Student Number " << student << " got a " << cs135[student] << endl;	cout << "The average score for the last exam is: " << findAvg(cs135, 10);	//This is just to keep the console window up.	cin >> student;	return 1;}int findAvg(int ar[], int sizeOfAr){	int sum = 0;	int avg;	//Add up the grades for all the students and	//find the average test score.	for(int i = 0; i < sizeOfAr; i++)		sum = sum + ar[i];	avg = sum/sizeOfAr;	return avg;}