You are on page 1of 5

Materi 4

Contoh 4.1

Contoh 4.2
Contoh 4.3
LATIHAN

#include <iostream>

#include <conio.h>

using namespace std;

main()

char operasi;

float P, L, T;
cout << "Panjang Balok P = "; cin >> P;

cout << "Lebar Balok L = "; cin >> L;

cout << "Tinggi Balok T = "; cin >> T;

cout << "\nPerhitungan: \n";

cout << "a. Volume\n";

cout << "b. Luas Permukaan\n";

cout << "pilih a dan b: ";

cin >> operasi;

switch (operasi)

case 'a' :

cout << "Volume =" << P*L*T;

break;

case 'b' :

cout << "Luas Permukaan =" << (2*P*L) + (2*P*T) + (2*L*T);

break;

default :

cout << "Inputan Anda Salah. . . \n\n";

break;

getch();
}

You might also like