Ejemplo n.º 1
0
int main(){
  string loja, fichClients, fichProdutos, fichTransacoes;

  // pede a informacoo sobre o nome da loja e os 3 ficheiros com
  // informacoo de clientes, produtos e transacoes
 // if(! infoInicial(loja, fichClients, fichProdutos, fichTransacoes))
   // return(-1);

  loja = "grande loja";
  fichClients = "clientes.txt";
  fichProdutos = "produtos.txt";
  fichTransacoes = "transacoes.txt";

  // cria uma loja
  VendeMaisMais supermercado(loja, fichClients, fichProdutos, fichTransacoes);

  cout << "Informacao da loja '" << loja << " do supermercado Vende++:" << endl;
  cout << supermercado << endl;  // mostra estatisticas da loja

  opcoesIniciais(supermercado); // menu inicial com as grandes opcoes
				// que implementam as funcioanlidades
				// disonibilizadas

  return 0;
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
0
int main() {
	string loja, fichClients, fichProdutos, fichTransacoes;
	//
	// pede a informacoo sobre o nome da loja e os 3 ficheiros com
	// informacoo de clientes, produtos e transacoes
	if (!infoInicial(loja, fichClients, fichProdutos, fichTransacoes)) {
        cout << Table({"Nao foi possível ler todos os ficheiros. Por favor verifique os ficheiros."}) << endl;
		return(1);
	}
	//
	// cria uma loja
	VendeMaisMais supermercado(loja, fichClients, fichProdutos, fichTransacoes);


    opcoesIniciais(supermercado);
    
    
	return 0;

}
Ejemplo n.º 4
0
void Menu()
{
	string loja, fichClients, fichProdutos, fichTransacoes;
	cout << "What client file do you wish to work with?:";
	getline(cin, fichClients);
	cout << "What product file do you wish to work with?:";
	getline(cin, fichProdutos);
	cout << "What transaction file do you wish to work with?:";
	getline(cin, fichTransacoes);
	VendeMaisMais supermercado("Vende ++", fichClients, fichProdutos, fichTransacoes);
	clearScreen();
	while (true)
	{
		cout << "\\\\                    //" << "        " << "               " << "                " << "             " << "              ||||          " << "               ||||          " << endl;
		cout << " \\\\                  //" << "         " << "               " << "                " << "             " << "             ||||          " << "              ||||          " << endl;
		cout << "  \\\\                //" << "          " << "               " << "                " << "             " << "            ||||          " << "              ||||          " << endl;
		cout << "   \\\\              //" << "  _________" << "               " << " _______     " << "   _________" << "               ||||          " << "              ||||          " << endl;
		cout << "    \\\\            //" << " ||_________" << " ||\\\\      ||" << " ||_______\\\\  " << "  ||_________" << "    _ _ _ _ _ ||||_ _ _ _ _ _" << "   _ _ _ _ _ ||||_ _ _ _ _ _" << endl;
		cout << "     \\\\          //" << "  ||         " << " || \\\\     ||" << " ||        \\\\ " << "  ||         " << "   __________    _ _ _ _ _ _" << "  __________    _ _ _ _ _ _" << endl;
		cout << "      \\\\        //" << "   ||______   " << " ||  \\\\    ||" << " ||         \\\\" << "  ||______   " << "  __________    _ _ _ _ _ _" << "  __________    _ _ _ _ _ _" << endl;
		cout << "       \\\\      //" << "    ||______   " << " ||   \\\\   ||" << " ||          || " << "||______   " << "            ||||          " << "             ||||          " << endl;
		cout << "        \\\\    //" << "     ||         " << " ||    \\\\  ||" << " ||         //  " << "||         " << "           ||||          " << "             ||||          " << endl;
		cout << "         \\\\  //" << "      ||_________" << " ||     \\\\ ||" << " ||________//   " << "||_________" << "          ||||          " << "             ||||          " << endl;
		cout << "          \\\\//" << "       ||_________" << " ||      \\\\||" << " ||_______//    " << "||_________" << "         ||||          " << "             ||||          " << endl;
		string initialOption;
		cout << endl;
		cout << "Welcome to VENDE + +, client software, please select the option that you want to work with:" << endl;
		cout << "1. Client management." << endl;
		cout << "2. Transactions management." << endl;
		cout << "3. Recomendations." << endl;
		cout << "4. Save and exit." << endl;
		cout << "Option:";
		getline(cin, initialOption);
		while (initialOption != "1" && initialOption != "2" && initialOption != "3" && initialOption != "4")
		{

			cout << "Invalid option! Please insert a valid one!:";
			getline(cin, initialOption);
		}

		if (initialOption == "1")
		{
			string initialClientOption;
			clearScreen();
			while (true)
			{
				cout << "What client option do you wish to work with?" << endl;
				cout << "1. View all clients." << endl;
				cout << "2. View a specific client." << endl;
				cout << "3. Add a client." << endl;
				cout << "4. Remove a client." << endl;
				cout << "5. Change a client'name." << endl;
				cout << "6. View the 10 worst clients." << endl;
				cout << "7. Go back to the previous menu." << endl;
				cout << "Option:";
				getline(cin, initialClientOption);

				while (initialClientOption != "1" && initialClientOption != "2" && initialClientOption != "3" && initialClientOption != "4" && initialClientOption != "5" && initialClientOption != "6" && initialClientOption != "7")
				{
					cout << "Invalid option! Please insert a valid one:";
					getline(cin, initialClientOption);
				}

				if (initialClientOption == "1") {
					string a = "a";
					clearScreen();
					supermercado.listarClientesOrdemAlfa();
					while (true) {
						cout << "When you wish to stop, press p and then ENTER." << endl;
						getline(cin, a);
						if (a == "p") {
							break;
						}
					}
					clearScreen();
				}

				if (initialClientOption == "2")
				{
					clearScreen();
					string nameC;
					cout << "What client do you want to see?. Please insert his/her name:";
					getline(cin, nameC);
					while (!supermercado.VerificadorDeNomes(nameC))
					{
						cout << "Name not found in client list! Please insert a valid name!:";
						getline(cin, nameC);
					}
					clearScreen();
					supermercado.mostraInformacaoCliente(nameC);
					clearScreen();

				}

				if (initialClientOption == "3")
				{
					clearScreen();
					string nName;
					cout << "What is the name of the new client:";
					getline(cin, nName);
					supermercado.adicionaCliente(nName);
					string a;
					do
					{
						cout << "Done! Press p and then ENTER to leave.";
						getline(cin, a);
					} while (a != "p");
					clearScreen();

				}

				if (initialClientOption == "4")
				{
					unsigned int id;
					clearScreen();
					supermercado.listarClientesOrdemAlfa();

					cout << "Insert the client id, you wish to remove:";
					cin >> id;
					while (cin.fail() || !supermercado.verificadorID(id))
					{
						cin.clear();
						cin.ignore(INT16_MAX, '\n');
						cout << "Invalid id! Please insert a valid one!:";
						cin >> id;
					}

					supermercado.removeCliente(id);
					string a;
					while (true) {
						cout << "Done! Press p and ENTER to exit: ";
						cin.ignore(INT16_MAX, '\n');
						getline(cin, a);
						if (a == "p") {
							break;
						}
					}

					clearScreen();
				}

				if (initialClientOption == "5")
				{
					clearScreen();
					unsigned int id;
					string nNome;
					cout << "What name do you want to change the client to?:";
					getline(cin, nNome);
					cout << "Which client do you want to change the name? Please inser his/her id:";
					cin >> id;
					while (cin.fail() || !supermercado.verificadorID(id))
					{
						cin.clear();
						cin.ignore(INT16_MAX, '\n');
						cout << "Invalid id! Please insert a valid one!:";
						cin >> id;
					}
					supermercado.alteraNome(id, nNome);
					cin.ignore(INT16_MAX, '\n');
					string a;
					do
					{
						cout << "Done! Press p and exit to leave!";
						getline(cin, a);
					} while (a != "p");

					clearScreen();

				}

				if (initialClientOption == "6")
				{
					clearScreen();
					supermercado.DezPiores();
					clearScreen();
				}

				if (initialClientOption == "7")
				{
					clearScreen();
					break;
				}

			}