Well, a friend of mine is learning how to program in C++, I'm too, but I'm still a noob. She needs to make a cuadratic calculator, but she tells me that the program, when compiled, gives an error "permission denied". She uses dev c++ btw. Here, can you take a look to the code?, I will really apreciate if someone can figure out the problem:
Thanks in advance
EDIT: fixed the code
Code:
#include <cstdlib>
#include <iostream>
#include <math.h>
#include <conio.h>
using namespace std;
int main(int argc, char *argv[])
{
int a = 0;
int b=0;
int c = 0 ;
int n= 4;
double x1=0;
double x2=0;
cout <<"ingresa el valor de
a"<< endl;
cin >>a;
cout <<"imngresa el valor de
d"<< endl;
cin >>b;
cout<<" ingresa el valor de
c"<< endl;
cin >> c;
/***aplicacion de la formula
general*/
int resultadoFormula =
(b*b)-(n*a*c);
if( a ==0)
{
cout <<"el resultado en 0"<<
endl;
}
else
{
x1=
(-b+sqrt(resultadoFormula))/(2*a);
x2 =
(-b-sqrt(resultadoFormula))/(2*a);
if(x1 == x2)
{
cout << "La unica solucion
es:" << x1;
}
else
{
cout << "La primera
solucion es: " << x1 << endl;
cout << "La segunda
solucion es: " << x2 << endl;
}
}
system("PAUSE");
return 0;
}
Thanks in advance
EDIT: fixed the code