توضيح در مورد مشكلات اين كد
ميشه در مورد مشكلات اين كد بهم توضيح بدين:11:
کد:
//LISTING CODE OF RECTANGLE
#include <iostream>
using namespace std;
class Rect
{
public:
Rect(int ,int);
~Rect() {}
void SetThings(int,int,bool x = false);//X MEANS TRUE OR FALSE
private:
int itsWidth;
int itsHeight;
};
Rect::Rect(int width,int height)
{
itsWidth = width;
itsHeight = height;
}
void SetThings(int aWidth,int aHeight,bool x)
{
int Height;
int Width;
if(x == true)
{
Height = itsHeight;
Width = itsWidth;
}
Height = aHeight;
Width = aWidth;
for(int i = 0;i < Height;i++)
{
for(int j = 0;j < Width;j++)
{
cout <<"*";
}
cout <<endl;
}
int main()
{
Rect theRect(30,5);
cout <<"bero be settings=>\n"<<theRect.SetThings(40,4,false)<<endl;
cout <<"dobareh bero be settings=>\n"<<theRect.SetThings(40,4,true)<<endl;
return 0;
}//BYE!@!