All pastes #398089 Raw Edit

Unnamed

public cpp v1 · immutable
·published 2007-03-16 22:59 UTC
rendered paste body
#include <iostream>#include <math.h>using namespace std;class kegel{	private:	float h,//Hoehe	r1,	//Radius 1	r2,	//Radius 2	pi;	//Pi		public:	kegel(float h=10.0f, float r1=5.0f, float r2=0.05f):h(h),r1(r1),r2(r2),pi(float(4.0f*atan(1.0)))			{			cout<<"Konstruktor kegel\n"			<<"h= "<<h<<"\n"			<<"r1= "<<this->r1<<"\n"			<<"r2= "<<(*this).r2<<"\n"			<<"pi= "<<this->pi<<endl			<<"Parameter r1= "<<r1<<endl<<endl;			}~kegel()	{		cout<<"Destruktor kegel\n"		<<"h= "<<this->h<<endl<<endl;	} 		float get_h(){ return h;}		float get_r1(){ return r1;}		float get_r2(){ return r2;}			void set_h(float h=0.0f){ this->h=h;}		void set_r1(float r1=0.0f){ this->r1=r1;}		void set_r2(float r2=0.0f){ this->r2=r2;}				int ein()		{		cout<<"Werte für Kegelstumpf\n";		cout<<"Hoehe h= "; h=0.0f;  cin>>h; cin.clear(); cin.ignore(INT_MAX, '\n');		cout<<"Radius r1= "; r1=0.0f; cin>>r1; cin.clear(); cin.ignore(INT_MAX, '\n');		cout<<"Radius r2= "; r2=0.0f; cin>>r2; cin.clear(); cin.ignore(INT_MAX, '\n');		}};int main(){	kegel k, k2(0.0f, 10.0f, 6.0f), k3(4.0f), k4(11.0f,33.0f,5.0f);	cin.get();	cout<<"k.h= "<<k.get_h()<<endl; //OK	k.set_h(11.0f);	cout<<"k.h= "<<k.get_h()<<endl;	float h=0.0f; cout<<"h= ";	cin>>h;	cin.clear();			//Fehlerbit zuruecksetzen	cin.ignore(INT_MAX,'\n');	//fehlerbehaftete Zeichen überspringen	k.set_h();	cout<<"k.h= "<<k.get_h()<<endl;	cin.get();}