help me!!!
my code..
=========================
#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;
bool readFile(int &hp, int &d, int &s){
char* file_name = "input.txt";
ifstream in;
in.open("input.txt");
in >> hp;
in >> d;
in >> s;
in.close();
if (hp < 1 || hp > 999) return false;
if (d < 1 || d > 1000) return false;
if (s < 1 || s > 100) return false;
return true;
}
int main()
{
int hp = 0;
int d = 0;
int s = 0;
float P1 = 0;
float P2 = 0;
float pR = -1;
if (pR==-1){cout<<"khong hop le\n"<<endl;
return 0;}
}
{----------------------------------->>>>>>>ERROR...
if(readFile(hp, d, s))
{
int i;
{
for (i=2;(i*i)<=hp;i++){
if (hp%i==0){P1=hp && P2=(hp+s);}
else {P1=1000 && P2=(hp+d)%1000;}
break;
}
return 1;
}
}
{
float g;
if (s%6==0)g=s/2;
else
if (s%6==1)g=2*s;
else
if (s%6==2)g=(float)(-(s%9)*(s%9)*(s%9)/5);
else
if (s%6==3)g=(float)(-(s%30)*(s%30)+3*s);
else
if (s%6==4)g=-s;
else {a==(s%5);g=(float)(-(a+5)*(a+6)/2);
}
{
if (d<200) {
int k;
k=(d+s);
int x=0,y=1,z=0;
while(z<k)
{
z=x+y;
x=y;
y=z;
}
if (z!=k && d<200)f=0;
else f=(float)(40-abs(d-500)/20+g);
}
else
{
if (d>=200 && d<=800) {
float r;
r=(float)(d+P1+P2)/1000;
if (d>=200 && d<=300 && r>0.8)cout<<pR=0<<endl;
else f=(float)(40-abs(int (d-500))/20+g);
}
}
}
{
if (d>800)f=(float)(-d*s/1000);
}
{
pR=(float)((P1+P2*f)/(1000+abs(P2*f)));
{
void display(float pR){
if (pR < 0) pR = 0;
else if (pR > 1) pR = 1;
else pR = floor(pR * 1000) / 1000;cout << pR;
}
cout>>pR>>endl;
return 1;
}
}
}
display(pR);
}
error C2447: '{' : missing function header (old-style formal list?)---ERROR..
PLEAS HELP ME...THANKS ALL..
Last edited on
you have double brackets after the first if in main
difficult to understand..are you said specific???..and fix for me???thanks you..
maybe It is better if you try to explaine what do want to do in this program
....and not a single tab was pressed.
Please format your code with the <> (Code Tags) button in the editor.
Which compiler do you use? Sometimes the "real" problem is not exactly what the compiler says it is...