Click here to Skip to main content
15,901,368 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have been working on my school project for 2 weeks and now it is finally done and it works properly. But there is a big problem - it is way too long. I made it as short as possible but it is not enough. It has to be max 220 lines long and mine now has more than 300 lines. Can someone help me make my code shorter? You can make any neccesary changes - delete something, add something, anything. It just has to work properly like it does now.

I would be very thankful for your help.

Since the code is very long, I have pasted it here: https://codeshare.io/GbP4wq There is also the task.

Thank you for any help.

I very very apologize if there is something that you do not understand. I tried to translate it the best I could.

What I have tried:

Everything in my knowledge, I have no idea what else can I do
Posted
Updated 5-Mar-18 3:34am
v2
Comments
CPallini 5-Mar-18 9:35am    
I see nothing at linked page.
Maciej Los 5-Mar-18 10:17am    
Not a question at all!

1 solution

Sorry, but no.
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
If part of your task is to produce code of a certain maximum length, then that is part of the job you are supposed to do - our doing it for you would be unfair on the others in your class with the same task.

Try it yourself, you may find it is not as difficult as you think!
Start by looking for common code, and abstracting it to functions or #define's.
Look for redundancy; think about what code is doing and work out if there is a "better way". If your requirement is 220 lines max, then I'm guessing the teacher expects around half that from most students...

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900