I know I can discover this answer myself from experience, but I think it is not a bad idea to hear others thought.
as introductory, I actually very interested anything involving logical understanding(math, physic) which then, brought me to programming, but then I discover that its(programming) more of an organizing data(breaking big problem into smaller one) and creativity subject, maybe I'm wrong?
it's such a shame that I can't solve a problem in chapter 1, from C++ Primer, 4th edition(Exercise 1.24). I think Summary for the exercise could give idea of what make me think of creativity has strong relation with programming:-
- the program want to read several transaction(which contain "different" ISBN)
-> which make me think of (while >> cin) loops.
- the program want that one with "same" ISBN, to sum up(which I thought they want
me to use "a = a + b" equation)
- then, print the record on the screen, based on ISBN,(where same isbn was
'group' already
- test input:-
(ISBN) (no. of book) (price)
0-201-78345-X 3 20.00
0-201-78345-X 2 25.00
0-201-78342-X 5 26.00
0-201-78341-X 1 35.00
0-201-78342-X 5 55.00
- EXPECTED result:-'
0-201-78345-X 5 22.50
0-201-78342-X 10 40.50
0-201-78341-X 1 35.00
-most important part is, the author want the reader to use his written class
`Sales_item` type , because of that, the operator and 'tools' is some sort limited
-where the operator is:-
> arithmetic(+, -), I/O(<< and >>), assign(=), and "same_isbn" function, where the
function is bool type indicating between 2 arguments if the ISBN is same. ONLY.
> of course you can use the built in library and some other usual noob
stuff(<iostream>, etc...)
and I don't know how to think anymore, already draw a lot of "loop diagram" on how the program works, but can't help with such tools so limited which I can't do much(stuck at loops, because if I edit a little, it affect whole program)
well, it's hard to explain of what I want to ask, so I think maybe question above can help. back to the title!
so, I already learned vector(already passed to chapter 6 in Accelerated C++), and I find some sort of solution using the container, so I came to conclusion that author want to test reader's creativity in programming from that exercise(above) or what?
Then, There come in my thought what programmer will do if they got limited tools for what their language have and their task(which why programming language is specified for certain task, right?) does programming actually involve that much creativity?
and. if possible, for experienced programmer, which is already used to loops, how do you think on how to control it ? I find it very frustrating when trying to edit them(after analyse it I can understand how it works, but then, I'm just depend on trial-and-error method to get my desired result(which I bet the "wrong" way on how programmer should think)
P.S. if you can answer the question, give some hint, if not, just don't bother, get to the main question(title)