Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- float lstabung(int r, int t);
- float vtabung(int r, int t);
- void garis();
- main(){
- system ("color 70");
- int jari, tinggi, pil;
- cout << "Penghitung Luas Permukaan dan Volume Tabung"<<endl;
- garis();
- cout << "Inputkan Jari-Jari : "; cin >> jari;
- cout << "Inputkan Tinggi : "; cin >> tinggi;
- cout << "1. Luas Selimut Tabung"<<endl<<"2. Volume Tabung"<<endl;
- cout << "Inputkan Pilihan : "; cin >> pil;
- garis();
- switch (pil) {
- case 1 : {
- cout << "Rumus = 2*phi*r*(t+r)"<<endl;
- cout << "2 * 3.14 * "<< jari <<" * "<<"("<< tinggi <<"+"<< jari << ")"<< lstabung(jari,tinggi);
- break;
- }
- case 2 : {
- cout << "Rumus = phi*r^2*t"<<endl;
- cout << "4.14 * " <<jari<<"^2 * "<<tinggi<<" = "<<vtabung(jari,tinggi);
- break;
- }
- }
- cin.get();
- }
- void garis(){
- cout << "==========================================="<<endl;
- }
- float lstabung(int r, int t){
- float phi=3.14,hasil;
- hasil = 2*phi*r*(t+r);
- return hasil;
- }
- float vtabung(int r, int t){
- float phi=3.14, hasil;
- hasil = phi*pow(r,2)*t;
- return hasil;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement