The observation that we do, we obtained the following data:
A. The flow of process activities in a restaurant:
a. Before the restaurant opened, owner of the restaurant to give the task to the managers to manage all employees.
b. Restaurant owner to give money to the treasurer to purchase supplies restaurant (Food, beverage ingredients, and cleaning tools)
c. Managers asked the cleaning services to clean and organize every room in the restaurant.
d. Treasurer buy restaurant equipment.
e. If all the rooms in the restaurant is clean and all equipment is available, the restaurant is ready to open.
f. If there are customers who come then set the vehicle parking attendants customers coming.
g. The customer enters into the restaurant to make a purchase.
h. Customers select their seats are available.
i. The waiter came to seat customers and provide a list of foods and drinks with friendly.
j. Customers choose foods and drinks and then returns a list of food and drink to the waiter.
k. The waiter gave food and beverage menu selected by the customer to the chef.
l. Chef cooking food and beverages selected by the customer.
m. If food and beverages is over cooked the waiters deliver food and drinks to customers.
n. Customers enjoy food and drinks that are served by waiters.
o. If customers are finished eating, the customer to the cashier to pay.
p. Cashier service payments. If the customer's money left over, the cashier will give the remaining money to the customer.
q. Then the customer leaves the restaurant and headed to the parking lot to pick up the vehicle.
r. After the customer left, the waiter took the food and beverage equipment already in use.
s. Waiters deliver the food and beverage equipment that is used to wash the dishes.
t. After the restaurant closed, managers told cleaning service to clean up all the room in a restaurant.
u. In addition, the Treasurer reported the financial results to managers.
v. After that, managers report all the results of the activities in the restaurant to restaurant owner.
B. Type of structure and function of the structure:
1. Owner of the restaurant:
Giving money to the treasurer and told manager to manage all staff in the restaurant.
2. Manager:
a) Manage employees.
b) Organize activities in a restaurant.
3. treasurer:
Managing money and buy all restaurant equipment.
4. chef:
Cook the food and drinks.
5. cashier:
Serving payments from customers.
6. waiter:
a) Deliver a list of foods and beverages to customers.
b) Serving food and drinks to customers.
c) Take food and drink equipment that is used by customers and delivered it to the dishwasher.
7. Dishwashers:
Washing eating utensils and drinking that has been used.
8. The cleaners:
Clean and organize every room in the restaurant.
9. Parking attendants:
Set the customer vehicle.
Tampilkan postingan dengan label Algoritma Pemrograman. Tampilkan semua postingan
Tampilkan postingan dengan label Algoritma Pemrograman. Tampilkan semua postingan
Selasa, 17 April 2012
Program untuk membedakan Persegi dan Persegi panjang
#include <iostream>
#include <string>
using namespace std;
class beda{
private:
int p,l;
public:
int rumus();
};
int beda::rumus(){
cout<<"Membedakan Persegi atau Persegi Panjang"<<endl;
cout<<"Masukan Panjang sisi: ";
cin>>p;
cout<<"Masukan Lebar sisi: ";
cin>>l;
if(p==l)
{cout<<"Merupakan Persegi"<<endl;}
else {cout<<"Merupakan Persegi Panjang"<<endl;}
}
int main()
{
beda x;
x.rumus();
system ("pause");
return 0;
}
#include <string>
using namespace std;
class beda{
private:
int p,l;
public:
int rumus();
};
int beda::rumus(){
cout<<"Membedakan Persegi atau Persegi Panjang"<<endl;
cout<<"Masukan Panjang sisi: ";
cin>>p;
cout<<"Masukan Lebar sisi: ";
cin>>l;
if(p==l)
{cout<<"Merupakan Persegi"<<endl;}
else {cout<<"Merupakan Persegi Panjang"<<endl;}
}
int main()
{
beda x;
x.rumus();
system ("pause");
return 0;
}
Mencetak bilangan antara 1 - 100 yang habis dibagi 5 dan 7 (C++)
#include <cstdlib>
#include <iostream>
using namespace std;
class bil{
public:
int proses();
int out();
private:
int i;
};
int bil::proses(){
for(int i=1;i<=100;i++){
if(i%5==0 && i%7==0)
{cout<<i<<endl;}
}
if (i==0)
return 0;
}
int bil::out(){
cout<<"Bilangan 1-100 yang habis dibagi 5 dan 7 adalah: "<<endl;
}
int main()
{
bil x;
x.out();
x.proses();
system("PAUSE");
return EXIT_SUCCESS;
}
#include <iostream>
using namespace std;
class bil{
public:
int proses();
int out();
private:
int i;
};
int bil::proses(){
for(int i=1;i<=100;i++){
if(i%5==0 && i%7==0)
{cout<<i<<endl;}
}
if (i==0)
return 0;
}
int bil::out(){
cout<<"Bilangan 1-100 yang habis dibagi 5 dan 7 adalah: "<<endl;
}
int main()
{
bil x;
x.out();
x.proses();
system("PAUSE");
return EXIT_SUCCESS;
}
Program membalik kata/kalimat yang diinputkan (C++)
#include <cstdlib>
#include <iostream>
#include <string.h>
using namespace std;
int main(int argc, char *argv[])
{
char kata[50];
cout<<"Masukkan Kata : ";
cin.getline(kata,sizeof(kata));
int pjgstring;
pjgstring=strlen(kata);
cout<<endl<<"Setelah Dibalik : \b";
for(int i=pjgstring;i>=0;i--){
cout<<kata[i];
}
cout<<endl<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
#include <iostream>
#include <string.h>
using namespace std;
int main(int argc, char *argv[])
{
char kata[50];
cout<<"Masukkan Kata : ";
cin.getline(kata,sizeof(kata));
int pjgstring;
pjgstring=strlen(kata);
cout<<endl<<"Setelah Dibalik : \b";
for(int i=pjgstring;i>=0;i--){
cout<<kata[i];
}
cout<<endl<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Program penjualan Bahan Bakar Minyak (C++)
#include <iostream>
#include <string>
using namespace std;
int main()
{
string raptor_prompt_variable_zzyz;
int i;
int l;
int x;
float jumlah;
int uang3;
int uang2;
int p;
float sisa;
int t;
int uang;
float sisa2;
float sisa3;
raptor_prompt_variable_zzyz ="Masukan Kode Bahan bakar:";
cout << raptor_prompt_variable_zzyz << endl;
cin >> x;
if (x==1)
{
cout << "Bensin" << endl; jumlah =4500;
i =1;
while (!(i>x))
{
raptor_prompt_variable_zzyz ="Masukan Liter:";
cout << raptor_prompt_variable_zzyz << endl;
cin >> l;
jumlah =jumlah*l;
i =i+1;
}
cout << "Anda membeli bensin (Dalam Liter):"<<l << endl; cout << "Total yang anda bayar:"<<jumlah << endl; raptor_prompt_variable_zzyz ="Uang yang dibayarkan:";
cout << raptor_prompt_variable_zzyz << endl;
cin >> uang;
sisa =uang-jumlah;
cout << "Uang anda: "<<uang << endl; cout << "Uang kembalian: "<<sisa << endl; }
else
{
if (x==2)
{
cout << "Solar" << endl; jumlah =4000;
i =2;
while (!(i>x))
{
raptor_prompt_variable_zzyz ="Masukan liter:";
cout << raptor_prompt_variable_zzyz << endl;
cin >> t;
jumlah =jumlah*t;
i =i+2;
}
cout << "Anda membeli Solar (Dalam Liter):"<<t << endl; cout << "Total yang anda bayar:"<<jumlah << endl; raptor_prompt_variable_zzyz ="Uang yang anda bayarkan: ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> uang2;
sisa2 =uang2-jumlah;
cout << "Uang anda: "<<uang2 << endl; cout << "Uang kembalian: "<<sisa2 << endl; }
else
{
if (x==3)
{
cout << "PERTAMAX GAN" << endl; jumlah =7000;
i =3;
while (!(i>x))
{
raptor_prompt_variable_zzyz ="Masukan liter:";
cout << raptor_prompt_variable_zzyz << endl;
cin >> p;
jumlah =jumlah*p;
i =i+3;
}
cout << "Anda membeli Pertamax (Dalam Liter):"<<p << endl; cout << "Total yang anda bayar:"<<jumlah << endl; raptor_prompt_variable_zzyz ="Uang yang anda bayarkan: ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> uang3;
sisa3 =uang3-jumlah;
cout << "Uang anda: "<<uang3 << endl; cout << "Uang kembalian: "<<sisa3 << endl; }
else
{
cout << "MAAF, KODE YANG ANDA MASUKKAN TIDAK TERSEDIA" << endl; }
}
}
system("pause");
return 0;
}
#include <string>
using namespace std;
int main()
{
string raptor_prompt_variable_zzyz;
int i;
int l;
int x;
float jumlah;
int uang3;
int uang2;
int p;
float sisa;
int t;
int uang;
float sisa2;
float sisa3;
raptor_prompt_variable_zzyz ="Masukan Kode Bahan bakar:";
cout << raptor_prompt_variable_zzyz << endl;
cin >> x;
if (x==1)
{
cout << "Bensin" << endl; jumlah =4500;
i =1;
while (!(i>x))
{
raptor_prompt_variable_zzyz ="Masukan Liter:";
cout << raptor_prompt_variable_zzyz << endl;
cin >> l;
jumlah =jumlah*l;
i =i+1;
}
cout << "Anda membeli bensin (Dalam Liter):"<<l << endl; cout << "Total yang anda bayar:"<<jumlah << endl; raptor_prompt_variable_zzyz ="Uang yang dibayarkan:";
cout << raptor_prompt_variable_zzyz << endl;
cin >> uang;
sisa =uang-jumlah;
cout << "Uang anda: "<<uang << endl; cout << "Uang kembalian: "<<sisa << endl; }
else
{
if (x==2)
{
cout << "Solar" << endl; jumlah =4000;
i =2;
while (!(i>x))
{
raptor_prompt_variable_zzyz ="Masukan liter:";
cout << raptor_prompt_variable_zzyz << endl;
cin >> t;
jumlah =jumlah*t;
i =i+2;
}
cout << "Anda membeli Solar (Dalam Liter):"<<t << endl; cout << "Total yang anda bayar:"<<jumlah << endl; raptor_prompt_variable_zzyz ="Uang yang anda bayarkan: ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> uang2;
sisa2 =uang2-jumlah;
cout << "Uang anda: "<<uang2 << endl; cout << "Uang kembalian: "<<sisa2 << endl; }
else
{
if (x==3)
{
cout << "PERTAMAX GAN" << endl; jumlah =7000;
i =3;
while (!(i>x))
{
raptor_prompt_variable_zzyz ="Masukan liter:";
cout << raptor_prompt_variable_zzyz << endl;
cin >> p;
jumlah =jumlah*p;
i =i+3;
}
cout << "Anda membeli Pertamax (Dalam Liter):"<<p << endl; cout << "Total yang anda bayar:"<<jumlah << endl; raptor_prompt_variable_zzyz ="Uang yang anda bayarkan: ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> uang3;
sisa3 =uang3-jumlah;
cout << "Uang anda: "<<uang3 << endl; cout << "Uang kembalian: "<<sisa3 << endl; }
else
{
cout << "MAAF, KODE YANG ANDA MASUKKAN TIDAK TERSEDIA" << endl; }
}
}
system("pause");
return 0;
}
Menghitung keliling segitiga (C++)
#include <cstdlib>
#include <iostream>
using namespace std;
class segi{
private:
double s1,s2,s3,k;
public:
double in();
double pro();
};
double segi::in(){
cout<<"Masukan sisi A: ";
cin>>s1;
cout<<"Masukan sisi B: ";
cin>>s2;
cout<<"Masukan sisi C: ";
cin>>s3;
}
double segi::pro(){
k=s1+s2+s3;
cout<<"Keliling= "<<k<<endl;
}
int main()
{
segi x;
x.in();
x.pro();
system("PAUSE");
return EXIT_SUCCESS;
}
#include <iostream>
using namespace std;
class segi{
private:
double s1,s2,s3,k;
public:
double in();
double pro();
};
double segi::in(){
cout<<"Masukan sisi A: ";
cin>>s1;
cout<<"Masukan sisi B: ";
cin>>s2;
cout<<"Masukan sisi C: ";
cin>>s3;
}
double segi::pro(){
k=s1+s2+s3;
cout<<"Keliling= "<<k<<endl;
}
int main()
{
segi x;
x.in();
x.pro();
system("PAUSE");
return EXIT_SUCCESS;
}
Menghitung luas segitiga (C++)
#include <cstdlib>
#include <iostream>
using namespace std;
class segi{
private:
double a,t,l;
public:
double in();
double pros();
};
double segi::in(){
cout<<"Alas :";
cin>>a;
cout<<"Tinggi :";
cin>>t;
}
double segi::pros(){
l=(a*t)/2;
cout<<"Luas= "<<l<<endl;
}
int main(int argc, char *argv[])
{
segi x;
x.in();
x.pros();
system("PAUSE");
return EXIT_SUCCESS;
}
#include <iostream>
using namespace std;
class segi{
private:
double a,t,l;
public:
double in();
double pros();
};
double segi::in(){
cout<<"Alas :";
cin>>a;
cout<<"Tinggi :";
cin>>t;
}
double segi::pros(){
l=(a*t)/2;
cout<<"Luas= "<<l<<endl;
}
int main(int argc, char *argv[])
{
segi x;
x.in();
x.pros();
system("PAUSE");
return EXIT_SUCCESS;
}
Menghitung keliling lingkaran (C++)
#include <cstdlib>
#include <iostream>
using namespace std;
class kll{
public:
int in();
int proses();
private:
int l,p,k;
};
int kll::in(){
cout<<"Masukan panjang: ";
cin>>p;
cout<<"Masukan lebar: ";
cin>>l;
}
int kll::proses(){
k=2*(p+l);
cout<<"Keliling ==> "<< k<<endl;
}
int main(int argc, char *argv[])
{
kll x;
x.in();
x.proses();
system("PAUSE");
return EXIT_SUCCESS;
}
#include <iostream>
using namespace std;
class kll{
public:
int in();
int proses();
private:
int l,p,k;
};
int kll::in(){
cout<<"Masukan panjang: ";
cin>>p;
cout<<"Masukan lebar: ";
cin>>l;
}
int kll::proses(){
k=2*(p+l);
cout<<"Keliling ==> "<< k<<endl;
}
int main(int argc, char *argv[])
{
kll x;
x.in();
x.proses();
system("PAUSE");
return EXIT_SUCCESS;
}
Menghitung keliling persegi panjang (C++)
#include <cstdlib>
#include <iostream>
using namespace std;
class kll{
public:
int in();
int proses();
private:
int l,p,k;
};
int kll::in(){
cout<<"Masukan panjang: ";
cin>>p;
cout<<"Masukan lebar: ";
cin>>l;
}
int kll::proses(){
k=2*(p+l);
cout<<"Keliling ==> "<< k<<endl;
}
int main(int argc, char *argv[])
{
kll x;
x.in();
x.proses();
system("PAUSE");
return EXIT_SUCCESS;
}
#include <iostream>
using namespace std;
class kll{
public:
int in();
int proses();
private:
int l,p,k;
};
int kll::in(){
cout<<"Masukan panjang: ";
cin>>p;
cout<<"Masukan lebar: ";
cin>>l;
}
int kll::proses(){
k=2*(p+l);
cout<<"Keliling ==> "<< k<<endl;
}
int main(int argc, char *argv[])
{
kll x;
x.in();
x.proses();
system("PAUSE");
return EXIT_SUCCESS;
}
Menghitung luas persegi panjang c++
#include <iostream>
#include <string>
using namespace std;
class jilnap{
private:
int a;
public:
int in();
int step();
};
int jilnap::in(){
cout<<"Masukan bilangan: ";
cin>>a;
}
int jilnap::step(){
if (a%2==0)
{cout<<"Bilangan "<<a<<" adalah bilangan genap"<<endl;}
else
{cout<<"Bilangan "<<a<<" adalah bilangan ganjil"<<endl;}
}
int main()
{
cout<<"=======Genap atau Ganjil?======="<<endl;
jilnap x;
x.in();
x.step();
system("pause");
return 0;
}
#include <string>
using namespace std;
class jilnap{
private:
int a;
public:
int in();
int step();
};
int jilnap::in(){
cout<<"Masukan bilangan: ";
cin>>a;
}
int jilnap::step(){
if (a%2==0)
{cout<<"Bilangan "<<a<<" adalah bilangan genap"<<endl;}
else
{cout<<"Bilangan "<<a<<" adalah bilangan ganjil"<<endl;}
}
int main()
{
cout<<"=======Genap atau Ganjil?======="<<endl;
jilnap x;
x.in();
x.step();
system("pause");
return 0;
}
Menentukan bilangan ganjil atau genap
#include <iostream>
#include <string>
using namespace std;
class jilnap{
private:
int a;
public:
int in();
int step();
};
int jilnap::in(){
cout<<"Masukan bilangan: ";
cin>>a;
}
int jilnap::step(){
if (a%2==0)
{cout<<"Bilangan "<<a<<" adalah bilangan genap"<<endl;}
else
{cout<<"Bilangan "<<a<<" adalah bilangan ganjil"<<endl;}
}
int main()
{
cout<<"=======Genap atau Ganjil?======="<<endl;
jilnap x;
x.in();
x.step();
system("pause");
return 0;
}
#include <string>
using namespace std;
class jilnap{
private:
int a;
public:
int in();
int step();
};
int jilnap::in(){
cout<<"Masukan bilangan: ";
cin>>a;
}
int jilnap::step(){
if (a%2==0)
{cout<<"Bilangan "<<a<<" adalah bilangan genap"<<endl;}
else
{cout<<"Bilangan "<<a<<" adalah bilangan ganjil"<<endl;}
}
int main()
{
cout<<"=======Genap atau Ganjil?======="<<endl;
jilnap x;
x.in();
x.step();
system("pause");
return 0;
}
Menentukan tahun kabisat dalam Class (C++)
#include <cstdlib>
#include <iostream>
using namespace std;
class kabisat{
private:
int t;
public:
int step();
int input();
};
int kabisat::input(){
cout<<"Masukan tahun: ";
cin>>t;
cout<<endl;
};
int kabisat::step(){
cout<<"========================================"<<endl;
if (t%4==0)
{cout<<"Tahun "<<t<<" Merupakan tahun kabisat"<<endl;}
else {cout<<"Tahun "<<t<<" bukan tahun kabisat"<<endl;}
cout<<endl;
};
int main()
{
kabisat g;
g.input();
g.step();
system("PAUSE");
return 0;
}
#include <iostream>
using namespace std;
class kabisat{
private:
int t;
public:
int step();
int input();
};
int kabisat::input(){
cout<<"Masukan tahun: ";
cin>>t;
cout<<endl;
};
int kabisat::step(){
cout<<"========================================"<<endl;
if (t%4==0)
{cout<<"Tahun "<<t<<" Merupakan tahun kabisat"<<endl;}
else {cout<<"Tahun "<<t<<" bukan tahun kabisat"<<endl;}
cout<<endl;
};
int main()
{
kabisat g;
g.input();
g.step();
system("PAUSE");
return 0;
}
Contoh Fungsi dalam c++ (Penjumlahan 2 Bilangan)
#include <cstdlib>
#include <iostream>
using namespace std;
int jumlah(){
int a,b,hasil;
cout<<"input";
cin>>a>>b;
hasil=a+b;
return hasil;
}
int main(int argc, char *argv[])
{
cout<<jumlah();
system("PAUSE");
return EXIT_SUCCESS;
}
#include <iostream>
using namespace std;
int jumlah(){
int a,b,hasil;
cout<<"input";
cin>>a>>b;
hasil=a+b;
return hasil;
}
int main(int argc, char *argv[])
{
cout<<jumlah();
system("PAUSE");
return EXIT_SUCCESS;
}
Langganan:
Postingan (Atom)


