Quick actions

cmd+k|ctrl+k

Navigation

Languages

Latihan 13.2 - Algoritma Struktur Data

Snippet info

Language

Cpp

Visibility

public

Author

anandara7891

Created

2026-01-03T06:01:14.286268Z

Updated

2026-02-05T07:57:22.854268Z

#include <iostream>
#define pi 3.14

using namespace std;

void garis() {
    cout<<"========================================================"<<endl;
}
void author() {
    garis();
    cout << "Nama  : Ananda Rakhma Aulia" << endl;
    cout << "NIM   : 3420220024" << endl;
    cout << "Email : [email protected]" << endl;
}
class tabung {
private:
    int j,t;
    float v,k;
public:
    void masukan();
    void keluaran();
};
void tabung::masukan() {
    garis();
    cout << "Program Menghitung Tabung" << endl;
    garis();
    cout << "Masukan Jari2 : "; cin >> j; cout<<endl;
    cout << "Masukan Tinggi : "; cin >> t; cout<<endl;
    v=(pi*j*j)*t;
    k=(2*(pi*j*2))+t;
    garis();
}
void tabung::keluaran() {
    cout << "Volume dari tabung adalah   : "; printf("%8.2f\n",v);
    cout << "Keliling dari tabung adalah : "; printf("%8.2f\n",k);
}
int main() {
    tabung tabung_obj;
    tabung_obj.masukan();
    tabung_obj.keluaran();
    author();
    
    return 0;
}
INFO