Answer to Question #248544 in C++ for muskan

Question #248544

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


1
Expert's answer
2021-10-08T04:35:06-0400
#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();
	
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS