Question #248544

define a class length with feet (int type )and (float type) data members.define do-nothing constructor


Expert's answer

#include<iostream>
using namespace std;


class length{
	private:
		int feet;
		float inches;
	public:
		length(){
			
		}
		
		void setLength(int f, float in){
			feet = f;
			inches =  in;
		}
		void display(){
			cout<<feet<<"."<<inches<<endl;
		}
};


int main(){
	
	
	length le;
	le.setLength(2, 9998);
	le.display();
	
}
LATEST TUTORIALS
APPROVED BY CLIENTS