Home > Back-end >  The great god, help me to take a look at this program which a problem...
The great god, help me to take a look at this program which a problem...

Time:09-23

#include
using namespace std;
The class area
{
Public:
Void area_oblong_1 (float, float);
Void area_oblong_2 (float, float);
Void display_1 ();
Void display_2 ();
Void the display ();
Float area_1 area_2;
Private:
The float length;
Float width;
};
The void area: : area_oblong_1 (float, float)
{
cin> length> Width;
Area_1=length * width;
}
The void area: : area_oblong_2 (float, float)
{
cin> length> Width;
Area_2=length * width;
}
Void area: : display_1 ()
{
Cout<& lt;" Area="& lt; }
Void area: : display_2 ()
{
Cout<& lt;" Area="& lt; }
Void area: the display ()
{
Cout<& lt;" Addarea="& lt; }

Int main ()
{
Area c1, c2 and c3;
Float length and width;
Float area_1 area_2;
Cout<& lt;" Enter some data of oblong (length, width) : "& lt; C1. Area_oblong_1 (length, width);
C2. Area_oblong_2 (length, width);
C1. Display_1 ();
C2. Display_2 ();
C3. The display ();
return 0;
}

CodePudding user response:

Int main ()
{
Area c1;
Float length and width;
Float area_1 area_2;
Cout<& lt;" Enter some data of oblong (length, width) : "& lt; C1. Area_oblong_1 (length, width);
C1. Area_oblong_2 (length, width);
C1. Display_1 ();
C1. Display_2 ();
C1. The display ();
return 0;
}

All change to c1 operation on an object,

C1. Area_oblong_1 (length, width);//calculate the c1 area_1 calculated the
C2. Area_oblong_2 (length, width);//calculate the c2 area_2 calculated the
C1. Display_1 ();//show the c1. Area_1 c1. Area_2 c1. The area is a random number
C2. Display_2 ();//show the c2. Area_2 c2. Area_1 c2. The area is a random number
C3. The display ();//c1. Area_1 c1. Area_2 c1. The area is a random number

The building Lord objects are fuzzy operation, and
Also ask questions please describe ideas, the project program is for others to see, is not written for himself,

CodePudding user response:

Thanks to the great god help ah

CodePudding user response:

Post code with code format, want to like this
 int main () 
{
Area c1;
Float length and width;
Float area_1 area_2;
Cout<& lt;" Enter some data of oblong (length, width) : "& lt; C1. Area_oblong_1 (length, width);
C1. Area_oblong_2 (length, width);
C1. Display_1 ();
C1. Display_2 ();
C1. The display ();
return 0;
}

CodePudding user response:

Well, thank you!
  • Related