g++ compiles but nothing happens when I run

I have to write a code that has the cin.fail()==0 check in the body, so that when you try to enter a negative number it replies that can't be done. The g++ does compile. But, when I run the program, nothing happens. It worked fine before I started adding this part. Can anyone see why it stares at me blankly?

#include <iostream>
#include <cmath>
using namespace std;
const double G=6.673*pow(10.0,-11.0);
int main()
{
double m1=0.0,m2=0.0,D=0.0,r1=0.0,r2=0.0,F=0.0,inc=0.0;
//Input
bool done=false;
while (done=false){
cout<<"Enter the mass of planet #1 in kg: ";
cin>>m1;
if(cin.fail()==0){
if (m1>0.0){
done=true;
}
else{ //cinfail=1
cout<<"Planets can't have negative mass!\n";
cin.clear();
cin.ignore(256,'\n');
}
}
cout<<"Enter the mass of planet #2 in kg: ";
cin>>m2;
cout<<"Enter the radius of planet #1 in meters: ";
cin>>r1;
cout<<"Enter the radius of planet #2 in meters: ";
cin>>r2;
cout<<"Enter the distance between planet #1 and planet #2 in meters: ";
cin>>D;
inc=D/20.0;
double curDist=D;
while(curDist>0)
{
F=((m1*m2)/pow((curDist+r1+r2),2.0))*G;
//Output
cout<<"The force of attraction between planet #1 & planet #2 =\t"<<F<<" Newtons\n"<<endl;
curDist=curDist-inc;
}
}
return 0;
}
while (done=false){ should probably be while (done==false){.
Topic archived. No new replies allowed.