program to determine whether the build is square or rectangular

In this post I will provide coding c + + program determine whether the build of the square or rectangle by using Claas overload

This was his coding in c + +:

#include <cstdlib>
#include <iostream>

using namespace std;

class build{
friend ostream& operator<<(ostream&, build&);
friend istream& operator>>(istream&, build&);

public:
build(){};

void proses(){
if(p==l){
result = “This building is a square”;
}else hasil = “This building is a rectangle”;
}

private:
float p;
float l;
char *result;
};

istream& operator>>(istream& in, build& number){
cout<<“enter the long= “;
in >>number.p;
cout<<“enter the width = “;
in >>number.l;

return in;
}

ostream& operator<<(ostream& out, build& long_width){
cout<<“\n\n”;
cout<<“Long “<<long_width.p;
cout<<endl;
cout<<“width”<<long_width.l;
cout<<” \n\n”;
cout<<long_width.result;

return out;
}

int main(int argc, char *argv[])
{
build cm;
cin >> cm;
cm.process();
cout<< cm;
cout<< endl;

system(“PAUSE”);
return EXIT_SUCCESS;
}

then please you compile C + + on your computer
thank you🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: