Can anyone tell me whats wrong with this code
So I finished it but it wont run. This is the code I have.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#include <cstdlib>
#include <iostream>
#include <math.h>
using namespace std;
int main(int argc, char *argv[])
{
char reply;
double a;
double b;
double c;
double q1;
double q2;
do
{
cout<<"enter a value:"<<endl;
cin>>a;
cout<<"enter b value:"<<endl;
cin>>b;
cout<<"enter c value:"<<endl;
cin>>c;
q1=(-b-sqrt(b*b - 4*a*c)/2/a
(q2=(-b+sqrt(b*b - 4*a*c)/2/a)
cout<<"The values of x are "<<q1<<"and"<<q2<<endl;
cout<<"do you want to find more x values?(Y/N)"<<endl;
cin>>reply;
}
while(reply="y");
system("PAUSE");
return EXIT_SUCCESS;
}
|
The compiler is telling me its the
1 2 3
|
cout<<"The values of x are "<<q1<<"and"<<q2<<endl;
cout<<"do you want to find more x values?(Y/N)"<<endl;
cin>>reply;
|
Semi-colons missing on 25/26
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#include <cstdlib>
#include <iostream>
#include <math.h>
using namespace std;
int main(int argc, char *argv[])
{
string reply;
double a;
double b;
double c;
double q1;
double q2;
do
{
cout<<"enter a value:"<<endl;
cin>>a;
cout<<"enter b value:"<<endl;
cin>>b;
cout<<"enter c value:"<<endl;
cin>>c;
q1=(-b-sqrt(b*b - 4*a*c)/2/a);
q2=(-b+sqrt(b*b - 4*a*c)/2/a);
cout<<"The values of x are "<<q1<<"and"<<q2<<endl;
cout<<"do you want to find more x values?(Y/N)"<<endl;
cin>>reply;
}
while(reply=="y");
system("PAUSE");
return EXIT_SUCCESS;
}
|
Some basic wrongs.
Topic archived. No new replies allowed.