Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 readScore

Declare String readPlayer = X

// open output file

Open scoresFile golf.dat

// write names and scores to file

While readPlayer != Z

Display Enter player name (Z to terminate):

Input readPlayer

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 input file

Open scoresFile golf.dat

// read and display all players in the file

While NOT eof(scoresFile)

Read scoresFile readPlayer readScore

Display Player , readPlayer, , score ,readScore

End While

// close the file

Close scoresFile

End Module

Output should look likes this:

Read each player's name and golf score from the keyboard and store them in a file.

Enter a player's name: Arnold Palmer Enter the player's score 74 Do you want to enter another record? Enter y for yes or anything else for no: y ... Store the data as comma separated records. For example: Arnold Palmer,74 Tiger Woods,69 Sam Snead,89 Micky Mouse,113 NOTE: On a windows machine, the file may be read with notepad. Other operating systems will have similar text editors to check the result. 

6-2 Read data from a file

Quick and dirty table without a header

Player Name: Arnold Palmer Score: 74 Player Name: Tiger Woods Score: 69 Player Name: Sam Snead Score: 89 Player Name: Micky Mouse Score: 113

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions

Question

Write the Chinese numeral as a HinduArabic numeral. +

Answered: 1 week ago

Question

How was their resistance overcome?

Answered: 1 week ago

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago