y apponet, and (4he vinning magia" fo ce berween the nns scoed by Redar and gam should pri, cleaty labeled ing perceage (aa decimal taction, gindicating wheder Redlar had a win I uns scored by RedHar in

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I have the question and the answer for this problem I just want to understand the concepts and logic of how to do it step by step

 

Write a complete C program (excluding comments) to analyze the wsults of the RedHar baseball wam's most
recent season. The input, from a file named games.dar, consists of the number of runs scored by RedHat and
the number of runs scoed by the opponear a cach game. That is, there will be a pair of numbers for each
game; the first being the number of nuns by RedHat and the second being the number of nuns of opponent.
Your program should produce a 4 column table showing: (1) the game number (1,2,. (2) the runs by
RedHar, (3ydhe nuns by opponent, and (4the "winning margia" for that game, where the "winning margia" is
defined as the difference between the runs scored by RedHat and the runs scored by the opponenE. If the
opponent scoed moe runs, the "winning margin" will be negative.
Below the table, your program should prie, clearty labeled:
#wins
A. the winning percentage (a
(as a decimal fraction,
-) for Redilat
totalt games
B. amessage indicating whether RedHat had a winning or a losing or a breakeven season
C. the average number of runs scored by RedHat in those games ik won, and
D. the largest winning margin for RedHat.
All outpur should be writen to a file named games.out.
Vinclude sandiah
min)
lirt mynnshisum, margin, win.ngamenbigmang
float anwinp
FILE "fin, *fout
fin-fapen"gemes.dat".,
fout-fapen game.cut",":
wins-bngames-0paruns-00:
fprintfiout. "GameNumber Redhat Runs Oppennt Rams Winning Marginia"k
while(facantfin." Anyrum, Ahiarum)-0)
(ngamest:
megin-yruns-hisrum;
if(margin 0)
(auns -mtmyrun
awimt+:)
if(ngames-1)
else
ifimargin-tigmarg) bigmarg-magin
frintifioue. "d 15d %154 S1sda" ngames, mynm, hisruna, margink
wing (floawinosegames
twinp.5) fpeintf(kout,"Redhie had a winning sscnia"k
else
(ifmvins-agams2) fprintfikout,"Redhat had a brvakorven seasania"
fprintifout, "Redhat had a lming swasoria"k
ese
if(mwim0)
fprintf(fat,"Average rum scored in winning games was a"arunameim):
fprintfi fout, "Redhat diet win any gamestu
fprintfi( fout, "Biggest wining megin was dia" bigmeg:
Transcribed Image Text:Write a complete C program (excluding comments) to analyze the wsults of the RedHar baseball wam's most recent season. The input, from a file named games.dar, consists of the number of runs scored by RedHat and the number of runs scoed by the opponear a cach game. That is, there will be a pair of numbers for each game; the first being the number of nuns by RedHat and the second being the number of nuns of opponent. Your program should produce a 4 column table showing: (1) the game number (1,2,. (2) the runs by RedHar, (3ydhe nuns by opponent, and (4the "winning margia" for that game, where the "winning margia" is defined as the difference between the runs scored by RedHat and the runs scored by the opponenE. If the opponent scoed moe runs, the "winning margin" will be negative. Below the table, your program should prie, clearty labeled: #wins A. the winning percentage (a (as a decimal fraction, -) for Redilat totalt games B. amessage indicating whether RedHat had a winning or a losing or a breakeven season C. the average number of runs scored by RedHat in those games ik won, and D. the largest winning margin for RedHat. All outpur should be writen to a file named games.out. Vinclude sandiah min) lirt mynnshisum, margin, win.ngamenbigmang float anwinp FILE "fin, *fout fin-fapen"gemes.dat"., fout-fapen game.cut",": wins-bngames-0paruns-00: fprintfiout. "GameNumber Redhat Runs Oppennt Rams Winning Marginia"k while(facantfin." Anyrum, Ahiarum)-0) (ngamest: megin-yruns-hisrum; if(margin 0) (auns -mtmyrun awimt+:) if(ngames-1) else ifimargin-tigmarg) bigmarg-magin frintifioue. "d 15d %154 S1sda" ngames, mynm, hisruna, margink wing (floawinosegames twinp.5) fpeintf(kout,"Redhie had a winning sscnia"k else (ifmvins-agams2) fprintfikout,"Redhat had a brvakorven seasania" fprintifout, "Redhat had a lming swasoria"k ese if(mwim0) fprintf(fat,"Average rum scored in winning games was a"arunameim): fprintfi fout, "Redhat diet win any gamestu fprintfi( fout, "Biggest wining megin was dia" bigmeg:
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Managing System
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education