-
Notifications
You must be signed in to change notification settings - Fork 0
/
paragon.cpp
83 lines (75 loc) · 2.47 KB
/
paragon.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <iostream>
#include <fstream>
#include "paragon.h"
#include <string>
#include <ios>
#include "menu.h"
using namespace std;
fstream file;
void cleanup()
{
file.open("ticket.txt", ios::out);
file.close();
}
string int_to_string(int k)
{
std::string str = std::to_string(k);
return str;
}
void paragon_godzina (int godzina, int minuta) {
file.open("ticket.txt", ios::app);
file << "----------------------" << endl;
file << "Godzina: " << int_to_string(godzina) << ":" <<int_to_string(minuta) << endl;
file << "----------------------" << endl;
file.close();
};
void paragon_stolik (int line) {
file.open("ticket.txt", ios::app);
file <<"Nr stolika: "<< line << endl;
file << "----------------------" << endl;
file.close();
};
void paragon_imie (string word1) {
file.open("ticket.txt", ios::app);
file << "----------------------" << endl;
file <<"Imie:"<< word1 << endl;
file << "----------------------" << endl;
file.close();
};
void paragon_adres(string miejsc, string uli, int nrdom, int nrmie) {
file.open("ticket.txt", ios::app);
file << "----------------------" << endl;
file << "Adres: " << miejsc << ", " << uli << " " << nrdom << "/" << nrmie << endl;
file << "----------------------" << endl;
file.close();
};
void paragon_pozycja(string nazwa, double price, int porcja, double suma)
{
file.open("ticket.txt", ios::app);
file << setfill('.') << left << setw(40) << nazwa << "|" << setw(2) << porcja << " x " << setw(5) << price << "|" << setw(7) << suma << "PLN" << endl;
file.close();
};
void paragon_dania(int tablica_zamowienia[20][2])
{
double cana_jednostkowa = 0;
double cena_zbiorcza = 0;
string nazwa_dania = "";
int porcja = 0;
double suma = 0;
for (int i = 0; i < 20; i++)
{
if (tablica_zamowienia[i][0] != 0)
{
porcja = tablica_zamowienia[i][1];
cana_jednostkowa = menu_cena(tablica_zamowienia[i][0]);
cena_zbiorcza = cana_jednostkowa * porcja;
nazwa_dania = menu_nazwa(tablica_zamowienia[i][0]);
paragon_pozycja(nazwa_dania, cana_jednostkowa, porcja, cena_zbiorcza);
suma += cena_zbiorcza;
}
}
file.open("ticket.txt", ios::app);
file << "----------------------" << endl;
file << "Razem: " << right << setw(51) << suma << "PLN" << endl;
file.close();
};