Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "conio.h"
- #include <iomanip>
- using namespace std;
- int main()
- {
- int x = 0 , qty, a, b[10], c, d, harga[10], kali[10], total[10] = { 0 };
- char code, jenis[10][10];
- char header[3][10] = { "Kode", "Jenis", "Harga" };
- char header2[3][3][3][10] = { { { "D", "P", "S" }, { "DADA", "PAHA", "SAYAP" }, { "2500", "2000", "1500" } } };
- cout << "Gerobak Fried chicken"<<endl;
- cout << "-----------------------"<<endl;
- for (int a0 = 0; a0 <= 2; a0++)
- {
- cout << setiosflags(ios::left) << setw(9) << header[a0];
- }
- cout << endl;
- for (int b0 = 0; b0 <= 2; b0++)
- {
- for (int c0 = 0; c0 <= 2; c0++)
- {
- for (int d0 = 0; d0 <= 2; d0++)
- {
- cout << setiosflags(ios::left) << setw(3) << header2[d0][c0][b0];
- }
- }
- cout << endl;
- }
- cout << "-----------------------"<<endl;
- cout << "Banyak Jenis:"; cin >> qty;
- for (a = 1; a <= qty; a++)
- {
- cout << "Jenis KE:" << a<<endl;
- cout << "Kode Potong[D/P/S]:"; cin>>code;
- cout << "Banyak Potong:"; cin >> b[a];
- switch (code)
- {
- case 'D':
- case 'd':
- strcpy_s(jenis[a], "Dada");
- harga[a] = 2500;
- break;
- case 'P':
- case 'p':
- strcpy_s(jenis[a], "Paha");
- harga[a] = 2000;
- break;
- case 'S':
- case 's':
- strcpy_s(jenis[a], "Sayap");
- harga[a] = 1500;
- }
- kali[a] = b[a] * harga[a];
- total[x] = total[x] + harga[a] * b[a];
- }
- system("cls");
- cout << "\t\tGerobak Fried chicken" << endl;
- cout << "--------------------------------------------" << endl;
- char koplok[5][10] = { "No.", "Jenis", "Harga", "Banyak", "Jumlah" };
- char koplok2[4][10] = { "Potong", "Satuan", "Potong", "Harga" };
- for (int ab = 0; ab <= 4; ab++)
- {
- cout << setiosflags(ios::left) << setw(9) << koplok[ab];
- }
- cout << endl;
- for (int abc = 0; abc <= 3; abc++)
- {
- if (abc < 1)
- {
- cout << setiosflags(ios::right) << setw(15) << koplok2[abc];
- }
- else
- cout << setiosflags(ios::right) << setw(9) << koplok2[abc];
- }
- cout << endl;
- for (a = 1; a <= qty; a++)
- {
- cout << a;
- cout << setiosflags(ios::right) << setw(12) << jenis[a];
- cout << setiosflags(ios::right) << setw(9) << harga[a];
- cout << setiosflags(ios::right) << setw(7) << b[a];
- cout << setiosflags(ios::right) << setw(13) << kali[a];
- cout << endl;
- }
- cout << "--------------------------------------------" << endl;
- cout << setiosflags(ios::right) << setw(35) << "Jumlah Bayar:"<<total[x];
- _getch();
- return(0);
- }
- //coded by irwan
Advertisement
Add Comment
Please, Sign In to add comment