Hi,
So what about the reply I made yesterday?
http://www.cplusplus.com/forum/general/233587/#msg1050022
Are you going to post the assignment text in full so we can see what the actual question was?
Are you going to persevere with code in it's current state way below where it should be? Too afraid to shred it, then do it properly?
Don't worry, I have seen it before quite a number of times :+| People spend a couple of weeks working on their project, writing 500 LOC, only to have someone like me come along and suggest to completely reorganise it. It takes courage to do this, but at least there will be a sense of satisfaction that has been completed in a much better fashion. Think about the marks you will get for the assignment, at least a B+ or even an A+ , much better than a C- or D
It happens in Industry too. Kate Gregory has a video here, IIRC it's the right one:
https://www.youtube.com/watch?v=tTexD26jIN4
In the video she describes some code which had some 1,000 lines, starting
really badly , I kid you not:
1 2 3 4 5 6 7 8
|
start: // goto label
while(true) {
while (true) {
while (true) {
// 1000 lines of mess here ....
}
}
}
| |
The code was a nightmare to understand, and full of nasty and obscure bug creating code ; a disaster to maintain. So she suggested that the guy use the RAII idiom. Apparently he was a smart guy, and spent a whole week rewriting the code. The result: about 2 pages of easy to understand and maintain code, all the nasty, nasty bugs gone.
Perhaps your code is not
quite as dramatic as that, but you may have
half as much code that is much easier and better.
I might sound harsh, but I am just trying to appeal to your sense of courage in doing the right thing :+D
Regards