Dengan C++
#include <iostream>
using namespace std;
int main (int argc, char** argv){
int pil, nastel, nasyam, nassar, nasgor, nasor;
nastel=6000;
nasyam=8000;
nassar=7000;
nasgor=8500;
nasor=7500;
cout<<"1. nasi telor\n";
cout<<"2. nasi ayam\n";
cout<<"3. nasi sarden\n";
cout<<"4. nasi goreng\n";
cout<<"5. nasi orak arik\n";
switch(pil){
case 1:
cout<<"harga = "<<nastel;
break;
case 2:
cout<<"harga = "<<nasyam;
break;
case 3:
cout<<"harga = "<<nassar;
break;
case 4:
cout<<"harga = "<<nasgor;
break;
case 5:
cout<<"harga = "<<nasor;
break;
default:
cout<<"menu yang dimasukan tidak tersedia -_-";
}
}
Tampilan