-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
71 lines (56 loc) · 2.18 KB
/
main.cpp
File metadata and controls
71 lines (56 loc) · 2.18 KB
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
#include <iostream>
#include <string>
#include <vector>
#include "Vende++.h"
#include "Menus.h"
#include "utils.h"
#include <windows.h>
#include <windef.h>
#include <WinUser.h>
int main(){
string loja, fichClients, fichProdutos, fichTransacoes;
//tratamento da janela
HWND hwnd = GetConsoleWindow();
RECT desktop;
const HWND hDesktop = GetDesktopWindow();
GetWindowRect(hDesktop, &desktop);
MoveWindow(hwnd, desktop.right * 0.2, desktop.bottom * 0.2, desktop.right * 0.6, desktop.bottom * 0.6, TRUE);
HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE);
COORD max_size = GetLargestConsoleWindowSize(screen);
int console_x = max_size.X*desktop.right*0.6 / desktop.right - 1;
int console_y = max_size.Y*desktop.bottom*0.6 / desktop.bottom - 1;
if (console_x < 56)
{
console_x = max_size.X*desktop.right*0.9 / desktop.right + 3;
console_y = max_size.Y*desktop.bottom*0.9 / desktop.bottom - 1;
MoveWindow(hwnd, desktop.right * 0.025, desktop.bottom * 0.025, desktop.right * 0.95, desktop.bottom * 0.9, TRUE);
}
else if (console_y <= 15)
{
console_y = max_size.Y*desktop.bottom*0.9 / desktop.bottom - 1;
MoveWindow(hwnd, desktop.right * 0.2, desktop.bottom * 0.1, desktop.right * 0.6, desktop.bottom * 0.8, TRUE);
}
// pede a informacoo sobre o nome da loja e os 3 ficheiros com
// informacao de clientes, produtos e transacoes
if(! infoInicial(loja, fichClients, fichProdutos, fichTransacoes))
return(-1);
//fichClients = "clientes.txt";
//fichProdutos = "produtos.txt";
//fichTransacoes = "transacoes.txt";
// cria uma loja
VendeMaisMais supermercado(loja, fichClients, fichProdutos, fichTransacoes);
// atualiza vetores
lerClientesTxt(supermercado);
lerProdutosTxt(supermercado);
lerTransacoesTxt(supermercado);
supermercado.setMaxClientesId();
unsigned int maxId;
maxId = supermercado.getMaxClientesId();
cout << endl << endl << "Informacao da loja '" << loja << " do supermercado Vende++:" << endl;
cout << supermercado << endl; // mostra estatisticas da loja
system("pause");
opcoesIniciais(supermercado); // menu inicial com as grandes opcoes
// que implementam as funcioanlidades
// disponibilizadas
return 0;
}