Implement class and find its area.

0 Milburn camilo · September 30, 2015
Write a C++ program to implement class rectangle and find its area. 

#include
#include
class Rectangle
{
   int length,breadth,area;
   public:
   void readvalues()
   {
       coutlength>>breadth;
   }
   void recarea()
  {
      area=length*breadth;
      cout
I am Getting error.

Post a Reply

Replies

Oldest  Newest  Rating
0 ariel bitan · September 30, 2015
First of all,you should write a constructor.
Dr inc so all,the line that you wrote in readvalues will give you a syntax error because there isn't such thing coutvariable you need to write cout<<any variable you want;
and if you want to get input or output you can use operators.
I hope I've helped you!
  • 1

C++

106,949 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator