Question:
Given an input file that consists of several lines containing the following?
Bella Pearson
2012-10-12 11:49:53 UTC
Given an input file that consists of several lines containing the following information:

(a) Sex code: “m” or “f”
(b) Age (in years)
(c) Height (in inches)
(d) Weight (in pounds)

Write a program that produces a report in the following format:

Average Height / Weights for the Sample Population

Average Height Average Height Average Weight Average Weight
Age for Men (in) for Women (in) for Men (lb) for Women (lb)
------------ -------------- -------------- -------------- --------------
0-18 XX.X XX.X XXX.X XXX.X
19-35 XX.X XX.X XXX.X XXX.X
36 and over XX.X XX.X XXX.X XXX.X


Round all averages to the nearest tenth. Use nested if....else constructs (not repeated ifs) in this program.
Also use good programming techniques: meaningful variable names, meaningful comments, and proper indentation.

All input should come from an input file and all output should go to an output file named using your name plus the ".txt" extension. Use eof indicator to terminate input from the input file. You are to submit your .cpp source file.

Here is the input, which you copy / paste to your input file. I suggest you name it "input.txt".


m 13 52 89
m 18 72 160
f 18 62 112
f 31 65 125
f 65 60 150
m 63 67 145
f 49 67 155
m 40 80 267
m 25 78 302
f 45 70 172
f 27 72 188
f 20 66 132
m 20 68 180
f 50 58 133
m 42 64 129
m 47 67 201
f 36 63 140
m 8 48 75
f 24 68 163
m 36 66 212
f 29 65 137
f 12 46 95
m 41 74 198

In C++
Three answers:
TheMadProfessor
2012-10-12 12:15:52 UTC
Seems straightforward enough. What's your question?
arkontaky
2016-12-26 23:16:32 UTC
"i think that any attempt to talk extremely to the bully could basically be met with derisive insults, and could desire to place my son on the bully's radar, which may be undesirable. " "b) Do a violent ask your self attack on the bully making use of a cricket bat (which happens to be in his locker). declare self protection." B could do the comparable w/o reasoning! ain't? yet i could like A! That needs a extreme talk approximately comprehend to others along with your son! That in the event that they do no longer do the honor and that's a nasty habit, so which you don't be the undesirable guy and do comprehend! Respecting to others is yet another edge of being a gentleman, meaning you will no longer lose, yet income!! and then advise the A!
2014-09-05 21:49:17 UTC
sophisticated step try searching at google this will help


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...