Program Modifikasi 2 "Program Class Keliling Segitiga C++"
Modifikasi 2 (Program Class Keliling Segitiga C++)
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
class segitiga{
int ab, ac, bc;
public:
void sisi (int a, int b, int c);
int keliling (void){
int y=(ab+ac+bc);
return (y);
}
};
void segitiga :: sisi (int p, int q, int z){
ab = p;
ac = q;
bc = z;
}
int main(int argc, char** argv) {
segitiga rynto;
int p, q, z;
cout<<"Masukkan sudut AB : ";cin>>p;
cout<<"Masukkan sudut BC : ";cin>>q;
cout<<"Masukkan sudut AC : ";cin>>z;
rynto.sisi(p,q,z);
cout<<"Keliling Segitiga : "<<rynto.keliling();
return 0;
}
Program :
Hasil :
0 komentar:
Posting Komentar