Tugas Tambahan 7D

1. Buatlah program menu untuk menampilkan 3 program diatas, menggunakan perintah switch(simpan dengan nama lat7_4.cpp)

 

#include <iostream>
using namespace std;

int pilihan;
string text;

int main(){
cout << “================================\n”;
cout << ” NUR RAHMAN TRI NANDA \n”;
cout << ” 171011401798 \n”;
cout << “================================\n”;
cout << “Daftar bahasa pemrograman:\n”;
cout << “1. c++ \n2. java \n3. PHP\n”;

ulangi:

cout << “Silahkan Masukan Pilihan: “;

cin >> pilihan;

switch(pilihan){
case 1:
text=”Kamu memilih Pemrograman c++”;
break;
case 2:
text=”Kamu memilih Pemrograman java”;
break;
case 3:
text=”Kamu memilih Pemrograman PHP”;
break;
default:
goto ulangi;
}

cout << text;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s