Rabu, 30 Desember 2015

Menghtiung volume balok C++ "program modify dua"

#include <iostream>
using namespace std;
class balok{
int p,l,t;
public:
void balook(int,int,int);
int hasil(void){
return(p*l*t)
;}
};
void balok::balook(int a,int b,int c){
p=a;
l=b;
t=c;
}

int main(){
balok blok, blk;
int s,n,l;
cout<<"Panjang: ";cin>>s;
cout<<"Lebar: ";cin>>n;
cout<<"Tinggi: ";cin>>l;
blok.balook(s,n,l);
blk.balook(4,3,2);
cout<<blok.hasil()<<endl;
cout<<blk.hasil();
}

Tidak ada komentar:

Posting Komentar