Hey guys, I have a series problem really
I understand the concept in c++ but I don't know how to solve PROBLEM the most of it.
Give me advice how to think in the problem
thnx
Printable View
Hey guys, I have a series problem really
I understand the concept in c++ but I don't know how to solve PROBLEM the most of it.
Give me advice how to think in the problem
thnx
Every problem has some difference.Some problems can be grouped.But the term problem is so general so no specific answer can be given.If what i said is false,then we would have one programming language that would solve all the problems ,but as you know there is no perfect language,only better language for some sections.
You can start by actually understanding the problem.If you have a description of the problem be sure to read it as times as needed and understand every single line.If not ask the person that wrote the description for help.Then try to figure out how to solve the problem in paper maybe and then code :)
For example:
Problem:
How would i approach it:Code:Write a program that asks the user to input a name and then print to screen the name given.
[List][*]Read carefully the problem(trivial)[*]Solve the problem by the method divide and conquer.
- The problem has two parts.
- 1st - ask the user for the name
- 2nd - use a function that will receive the input data
- 3rd - write code to handle the input data.Store it somewhere(an array maybe)
- 4rth - print the name in the screen
[\List]- Now i would take every simple subproblem,solve it and then combine them all together so that the final problem is going to be solved.
- 1st - i need a function to print in screen.printf sounds good.What i want to display in the screen?Hmm..Let's say "Please give your name"
- 2nd - need to read the input.fgets or scanf may do the job
- 3rd - i would use an array of chars pointers or of string to store the data
- 4rth - use the same function as in sub-problem one<printf> and display the name that i have in the array and a message like this "Name given is : " (the msg should appear first)
- Fun time-write code-listen to the compiler-solve the problem :D
Thank you very much
I appreciate that :D