//comments
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdlib>

using namespace std;

bool isInt (double value) {
    double dummy;
    return bool(modf(value, &dummy) == 0);
}

double sqr(double value) { 
	return value * value; 
}

int main (void) {

double hubdia, //hub diameter
	   thick, //tire thickness
	   o, //interference value (sigma)
	   p, //interface pressure (in Pa)
	   b, //radius of the hub
	   c; //radius of the hub plus the tire thickness (in m)
const double E = 207e9;	//Young's modulus for the material
double great=0;
cout<<"Enter diameter, tire thickness, and interference (-1 -1 -1 to stop):"<<endl;
cin>> hubdia >> thick >>o;
	
while(!(hubdia==-1&&thick==-1&&o==-1)){
	
	if(!(hubdia>=0.5||hubdia<=2.5)||thick>=0.05||thick<=0.1||o>0||o<=(0.5*hubdia)){
		
		cout<<"Invalid values ignored."<<endl;
	}else{
		b=(hubdia/2);
		c=b+thick;
		
		p= (o/b)/((1/E)*(1+((c*c)+(b*b))/((c*c)-(b*b))));
		
		cout<<"The interface pressure is"<<p<<endl;
		if(great<p){
			great=p;
			GH=hubia;
			GT=thick;
			GS=o; //greates sigma
		}//endif
		
		avecount=avecount+1;
		count=count +1;
		
	} // end if
	
	cout<<"Enter diameter, tire thickness, and interference (-1 -1 -1 to stop):"<<endl;
	cin>> hubdia >> thick >>o;
}//endwhile

//MATH computations

ave=avecount/count;

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
}//end int main (void)

