Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 18.225.254.81
Web Server : Apache
System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.2.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0705) :  /home/snbittner/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/snbittner/assignmentg.cpp
//      CS112 CS I Assignment 5
//      Due: Mon. Nov. 1, 2010
//
//      File Name: assignment5.cpp
//      Author: Stephanie Bittner
//      Instructor: Dr. Wang
//
//      Compile: g++ assignment5.cpp
//      Run: ./a.out < in5.txt
//
//      Goal: The program will read a file with students scores, output 
//		the highest, lowest, and the average.


#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
	cout << fixed << showpoint << setprecision(1);
	
	int grade;
	int sum = 0;
	int highest = 0;
	int lowest = 100;
	int counter = 0; 	
	
	cin >> grade;
	highest = grade;
	while( cin )
	{	
		counter ++; 
		if ( grade > highest )
		 highest = grade;

	cin  >> grade;
		
		if ( grade < lowest )
		 lowest = grade;
	
		sum = sum + grade;
	}


	cout << "The highest grade is: " << highest << endl;
	cout << "The lowest grade is: " << lowest << endl;
	cout << "The average is: " << 1.0 * sum / counter << endl;
	cout << "\n\nByebye.\n\n";
return 0;
}

Stv3n404 - 2023