Question: From the textbook: Big C + + : Late Objects, Enhanced: E 7 . 3 Write a function that returns a pointer to the maximum

From the textbook: Big C++: Late Objects, Enhanced:
E7.3
Write a function that returns a pointer to the maximum value of an array of floating-point data:
double * maximum(double * a, int size)
If size is 0, return nullptr.
P7.8
Define a structure Student with a first name,last name and course grade(A,B,C,D, or F). Write a program that reads input in which each line has the first and last name and course grade separated by space. Upon reading the input, your program should print all students with grade A, then all students grade B and so on.
Sample Output:
Enter the Student first name and last name, grade, please leave space
Allan James F
Richard John A
James Allan F
Ethan Clark B
John James D
Peter John C
John Peter A
Initial list:
F Allan James
A Richard John
F James Allan
B Ethan Clark
D John James
C Peter John
A John Peter
Students sorted by grade:
A Richard John
A John Peter
B Ethan Clark
C Peter John
D John James
F James Allan
F Allan James
E8.5
Write a program that reads each line in a file, reverses its characters,
and writes the resulting line to another file. Suppose the user specifies
input.txt and output.txt when prompted for the file names, and input.txt
contains the lines
Mary had a little lamb
Its fleece was white as snow
And everywhere that Mary went
The lamb was sure to go.
After the program is finished, output.txt should contains
bmal elttil a dah yraM
wons sa etihw saw eceelf stI
tnew yraM taht erehwyreve dnA
.og ot erus saw bmal ehT
P8.6
Write a program that reads the country data in the file how_to_1/worldpop.txt (included with the books source code). Do not edit the file. Use the following algorithm for processing each line. Add characters that are not white space to the country name. When you encounter a white space, locate the next non-white space character. If it is not a digit, add a space and that character to the country name, and keep adding characters until the next white space. If a white space is followed by a digit, unget it and read the number. Print the total of all country populations (excepting the entry for European Union). Please download the worldpop.txt word file from the announcement.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!