0
Programming problems solving
How to think logically to solve any problems. I am in 12th I can solve maths problems like integration, differentiation and much more but I can't solve many problems in c++ because we are learning c++ at 12 grade how I fix my this problem
1 Réponse
+ 3
Programming is all about solving problems. There is the algorithm, the code structure, and the overall application design. All of these aspects need to be thought through.
What is the purpose of your program?
What are the desired outcomes overall?
What inputs will be required to calculate those outcomes?
What steps must you take to insure quality input?
How do you calculate the desired output?
How do you display the desired output?
What errors might happen at various stages?
You get an idea of what you need to do from thinking about the program like this.
Then you divide and conquer. Write the top-level loops and functions. Then the low-level loops and functions. Get it working.
As you break it into smaller and smaller problems, you are solving those small problems.
It's not unlike math. In algebra there are a bunch of small steps to perform a larger calculation. You have to do this, then that, then convert something, cross multiply something, whatever. Programming is the same.
To get a feel for it, I always suggest starting with a simple calculator app. Make an app that can add, subtract, multiply, divide. Then expand it to understand PEMDA. Then expand it to convert to HEX, OCT, DEC, BINARY. Then expand it calculate certain formulas.
The idea is to make it more complex and continue to expand it. As you expand it, you are learning valuable coding techniques.
If you don't like the calculator, then work with object design. Design a series of classes and give them properties.
Vehicle -> Car -> Model -> Instance
Keep expanding to support different engines, tires, occupants, owners, colors, etc. Figure out where each property goes. Define each property as it's own class.
Classes: Vehicle, Car, Truck, Bus, Wheel, Engine, Owner, Driver, Model, Color, Seats, Materials, Options, Brand
Just go to town making a complex body of objects and inheritance. Just do one part at a time and keep expanding it to make it all clear.
Start at the top - then divide and divide and divide.