Hello,
To start with, when you declare variables, initialize them right away:
double a = b = c = disc = x1 = x2 = 0.0;
Next, you will need to use cin or scanf to read the data into variables.
You will also need to check your operator precidence. Example:
4 * 3 / 4 + 6 = 9
4 * 3 / (4 + 6) = 4 * 3 / 10 = 1.2
Your disc equation will need help.
Let us know how it works.
Christian
kc0arf
Posting Virtuoso
1,937 posts since Mar 2004
Reputation Points: 121
Solved Threads: 57
Hello,
double a = b = c = disc = x1 = x2 = 0.0;
declares all of those variables as double values, and then assigns them a value of zero.
Remember that in C, = is the assign operator, and == is the equals operator.
scanf(%d, variable); scans in an integer
scanf(%lf, variable); scans in a floating double number
You are going to need to read your C or C++ book to find out how to set these things up properly, and gain a greater understanding of what you are trying to do.
Give it a shot.
Christian
kc0arf
Posting Virtuoso
1,937 posts since Mar 2004
Reputation Points: 121
Solved Threads: 57