Question: Please write a c++ code with proper use of variable constants for my pseudo code. I am take a class that is teaching me flow
Please write a c++ code with proper use of variable constants for my pseudo code. I am take a class that is teaching me flow charts and pseudocode and I would like to see the actual code so that I can start preparing myself for next semesters classes. Here is the pseudo code:
// main module
Module main()
// Local variables
Declare OutputFile scoresFile
Declare Integer count = 0, readScore, lowScore
Declare String readPlayer = X, lowPlayer
// open file
Open scoresFile golf.dat
// write names and scores to file
While readPlayer != Z
// enter player
Display Enter player name (Z to terminate):
Input readPlayer
// enter score
If readPlayer != Z
Display Enter score:
Input readScore
Write scoresFile readPlayer readScore
End If
End While
// close the file
Close scoresFile
Declare InputFile scoresFile
// open file
Open scoresFile golf.dat
// read and display all players in the file
While NOT eof(scoresFile)
Read scoresFile readPlayer readScore
Set count = count + 1
// initialize
If count == 1 Then
Set lowScore = readScore
End If
// test for low score
If readScore <= lowScore Then
Set lowScore = readScore
Set lowPlayer = readPlayer
End If
Display Number , count, Name ,readPlayer, , score ,readScore
End While
// close the file
Close scoresFile
Display Lowest player and score: ,lowPlayer, , ,lowScore
End Module
Output should look like this:
The same as 6-2 with the calculated best score
Player Name: Arnold Palmer Score: 74 Player Name: Tiger Woods Score: 69 Player Name: Sam Snead Score: 89 Player Name: Micky Mouse Score: 113
The player with the best score is Tiger Woods
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
