First, rethink yourself.
Making a program is the same as solving a common Math exercise. :)
Eg :
int a = 10;
int b = 20;
int average = (a / b) / 2; // = (10 + 20) / 2 = 15;
|
Programming requires perfect accuracy, so you must obey 100 % programming grammars (For specific languages such as C++ that you want)
For simple example :
int a = 10; //This command creates a variable name 'a' with initiation value is 10
int b = 35 //Error : Missing (;) - All commands must be ended by (;) symbol - 100 % rule
|
You need to download a compiler (Visual C++ 2008 is recommended)
How to make a program :
1- Create a base (root) that is used to start any program (100 % rule) , For ex C++
Console programs :
void main([...]) //Parameters are allowed to ignore or not
{ // Start program root
[...] // code here
}
|
2- Think about the target. For example you want to solve the equation ax + b = 0... Then each problem you'll need to :
- Get all necessary variables. You'll need to determine the input-output that you should have. For Ex equation ax + b = 0
Input : a, b (a = 0 is not allowed)
Output : x
|
- How to solve the problem.
Map the algorithm.
Step 1 : Input a,b
Step 2 : ax = -b
Step 3 : x = -b / a
|
A note : When a new value is generated after a calculation expression, you should pick a variable to store that value before it will be destroyed later.
Then, valid algorithm map :
Step 1 : Input a,b
Step 2 : b = b x (-1) (-b) //Store the final value (b x (-1)) into b variable.
Step 3 : x = b / a
|
Now you know the algorithm and you are totally ready to write your own code! And finally, my right program example :
1 2 3 4 5 6
|
int x, a = 8, b = 4; //Solving the equation 8x + 4 = 0 ('int' is a kind of variable)
void main()
{
b = b * (-1); // = 4 * (-1) = -4
x = b / a; // = -4 / 8 = (-0.5)
}
|
That's programming. You should find some basic C++ books (PDFs are recommended)
Or It you want, I'll always help you (lifetime) :)