Senin, 19 Maret 2012
Menghitung volume Kubus
list program C++
#include <cstdlib>
#include <iostream>
using namespace std;
class contoh{
friend istream&operator>>(istream&,contoh&);
friend ostream&operator<<(ostream&,contoh&);
public:
int proses(){return(a<b?b:a);
}
private:
int a,b;
};
istream&operator>>(istream&in,contoh&masukan){
cout<<”masukan bilangan pertma :”;
in>>masukan.a;
cout<<”masukan bilangan kedua :”;
in>>masukan.b;
}
ostream&operator<<(ostream&out,contoh&keluaran){
out<<”nilai max nya :”<<keluaran.proses();
}
int main(int argc, char *argv[])
{
contoh Contoh;
cin>>Contoh;
cout<<Contoh;
cout<<endl;
system(“PAUSE”);
return EXIT_SUCCESS;
}
Langganan:
Posting Komentar (Atom)
0 comments:
Posting Komentar