
Help sorting out errors
OK I've just wrote something to fill some time, and I thought I had done it all right, but when I try compile it, it gives some errors, but the errors don't make much sense to me really. It's giving error messages like ' and (each.
I'm pretty new so I have no idea what they're on about so I was hoping someone on here could help me.
Code:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
int main (int argc, char *argv[])
{
cout << "Works out two values of X in Quadratic Formulas (ax^2+bx+c=0)" << endl;
cout << "Integers only" << endl;
//Declare A,B,C,negative B, answer to both top and bottom halfs, number to be square rooted and the SQRT.
//Also declares answers.
int A;
int B;
int NegB;
int C;
int TopHalfP;
int TopHalfN;
int BottomHalf;
int InRoot;
int Root;
int AnswerP;
int AnswerN;
//Put values for A.B & C into the program.
cout << "Enter A" << endl;
cin >> A;
cout << "Enter B" << endl;
cin >> B;
cout << "Enter C" << endl;
cin >> C;
//Work out Negative B, the number to be SQRTed, the SQRT and the numbers to be divided
NegB = B*1;
InRoot = (b*b)(4*A*C); // Gives ' and (each
Root = sqrt(InRoot); //Gives call
TopHalfP = NegB+Root;
TopHalfN = NegBRoot;
BottomHalf = 2*A;
AnswerP = TopHalfP/BottomHalf;
AnswerN = TopHalfN/BottomHalf;
//Displays answers
cout << "The answers for X are:" << endl;
cout << AnswerP << endl;
cout << "And" << endl;
cout << AnswerN << endl;
cout << "Press ENTER to continue..." << endl;
cin.get();
return 0;
}
That's the source and the errors on lines 39 and 40 are in notes at the side.
It also gave some errors on lines in the hundreds, though this only gets to about 60 lines. I've put them in the image.
If anyone could help with any of these it would be great.

On line 39:
Code:
InRoot = (b*b)(4*A*C); // Gives ' and (each
There is no such variable "b". You probably wanted to use B.
For the error you get on the line with sqrt(), there are 3 types that sqrt() will take, float, double, and long double. Pick one to cast your int to and it will be fine. Also, since you are using integers, remember that you are going to lose any decimals from the sqrt and division that take place.

Code:
InRoot = (b*b)(4*A*C); // Gives ' and (each
there is no variable b. guess you mean B.
Code:
Root = sqrt(InRoot); //Gives call
there is no function sqrt() that takes an int as an argument > the compiler dosn't know if it should convert it to a double or a float.
declare inRoot as a double or a float.
Kurt
EDIT: far too slow today. :)

Oh yeah, thanks a lot dude.
It's compiled now and works. Soon as it prints the two answers though it shuts down the window. I thought cin.get(); should have meant you had to press something before it would continue, but obviously not.
If anyone knows why it's shutting down right after that would help, but for now I'll just put in a 5 second sleep though.
Thanks again for the help dude.

*sigh*
place cin.ignore() before the last get()

Lol, sorry. I said I'm new to it, should have expected the questions to be simple.
And thanks again.