Maksimum 3 bilangan in c++

ini adalah program menentukan bilangan terbesar antara 3 bilangan

 

#include <cstdlib>
#include <iostream>
#include <conio.h>

using namespace std;

class banding{
friend istream& operator>>(istream&, banding&);
public:
banding();
void kondisi();
private:
int A,B,C;
int max;
};

banding::banding(){
cout<<“Menentukan nilai maksimum dari dua bilangan\n\n”;
}

istream& operator>>(istream& in, banding& ma){
cout << “Bilangan pertama = “;
in >> ma.A;
cout << “Bilangan kedua = “;
cin >> ma.B;
cout << “Bilangan ketiga = “;
cin >> ma.C;
return in;
}

void banding::kondisi(){
max=A;
if (B>max)
max=B;
if (C>max)
max=C;
cout << “Bilangan terbesar : ” << max;
}

int main(int argc, char *argv[])
{
banding q;
cin>>q;
q.kondisi();

getch();
return 0;

system(“PAUSE”);
return EXIT_SUCCESS;
}


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