F
Frankie Montenegro
Hi everyone,
I must say that, even though I think
that Accelerated C++ by Koenig and Moo is an awesome
text, the wording of exercises is very poor. I
spend half the time just trying to figure out what is
it they want me to do. Anyway, I somehow managed
untill chapter 5 but now I am hopelessly stuck.
But I am completely lost with the wording of the
following three exercises:
5-2.
Write the complete new version of the student-grading
program, which extracts records for failing students,
using vectors. Write another that uses lists. Measure
the performance difference on input files of ten
lines, 1000 lines, and10000 lines.
My question: What does "complete new version" mean?
What improvements should I make? Maybe use iterators
instead of indices?
5-3.
By using a typedef, we can write one version of the
program that implements either a vector-based solution
or a list-based one. Write and test this version of
the program.
My question: I will assume that this problem refers to
the 5-2 although this is not quite clear. I am sure I
am missing something, but I can't figure out what
else is there to this problem except stating
"typedef vector container;" or "typedef list
container;"
and then using a type "container" in the rest of the code??
5-4.
Look again at the driver functions you wrote in the
previous exercise. Note that it is possible to write a
driver that differs only in the declaration of the
type for the data structure that holds the input file.
If your vector and list test drivers differ in any
other way, rewrite them so that they differ only in
this declaration.
My question:
OK, isn't this what I just did in 5-3?
Thanks everyone for help and apologies for a long-ass
question.
I must say that, even though I think
that Accelerated C++ by Koenig and Moo is an awesome
text, the wording of exercises is very poor. I
spend half the time just trying to figure out what is
it they want me to do. Anyway, I somehow managed
untill chapter 5 but now I am hopelessly stuck.
But I am completely lost with the wording of the
following three exercises:
5-2.
Write the complete new version of the student-grading
program, which extracts records for failing students,
using vectors. Write another that uses lists. Measure
the performance difference on input files of ten
lines, 1000 lines, and10000 lines.
My question: What does "complete new version" mean?
What improvements should I make? Maybe use iterators
instead of indices?
5-3.
By using a typedef, we can write one version of the
program that implements either a vector-based solution
or a list-based one. Write and test this version of
the program.
My question: I will assume that this problem refers to
the 5-2 although this is not quite clear. I am sure I
am missing something, but I can't figure out what
else is there to this problem except stating
"typedef vector container;" or "typedef list
container;"
and then using a type "container" in the rest of the code??
5-4.
Look again at the driver functions you wrote in the
previous exercise. Note that it is possible to write a
driver that differs only in the declaration of the
type for the data structure that holds the input file.
If your vector and list test drivers differ in any
other way, rewrite them so that they differ only in
this declaration.
My question:
OK, isn't this what I just did in 5-3?
Thanks everyone for help and apologies for a long-ass
question.