Ir para conteúdo
Fórum Script Brasil

Guilherme.Carvalho

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Tudo que Guilherme.Carvalho postou

  1. #include <iostream> #include <iomanip> // casas decimais #include <windows.h> // tabular gotoxy #include <cmath> // arredondar ceil using namespace std; void gotoxy(short x, short y) { COORD pos= {x,y}; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos); // comando tabular } int main () { setlocale(LC_ALL, "portuguese"); int part1=0, part2=0, opcao; int somapart=0; float cerveja=0, refrin=0, refrid=0, vaca=0, lingt=0, lingf=0, limao=0, tomate=0, cebola=0, vinagre=0, pao=0, carvao=0; float sal=0, det=0, esponja=0, papelh=0; float somacv = 0, somarn = 0, somard = 0, somav = 0, somalt = 0, somalf = 0, somal = 0, somat = 0; float somac = 0, somavi = 0, somap = 0, somaca = 0, somas = 0, somad = 0, somae = 0, somaph = 0; float total=0, margem=0, totalb=0, totalnb=0, totalb1=0, totalnb1=0, dif=0; string retornar = "S"; while ((retornar != "N") || (retornar != "n")) { cout << "__________CHURRASCO DA TURMA__________"<<endl<<endl<<endl; cout << "1 --> CADASTRE O NUMERO DE PARTICIPANTES"<<endl; cout << "2 --> CADASTRE O PRE�O DOS PRODUTOS"<<endl; cout << "3 --> IMPRIMIR A LISTA DE COMPRA"<< endl; cin >> opcao; system("cls"); if ((opcao == 3) && (part1 ==0) && (part2==0)) { cout << "OP��O INV�LIDA. N�O FOI CADASTRADO O N�MERO DE PARTICIPANTES."<<endl<<endl; cout << "__________CHURRASCO DA TURMA__________"<<endl<<endl<<endl; cout << "1 --> CADASTRE O N�MERO DE PARTICIPANTES"<<endl; cout << "2 --> CADASTRE O PRE�O DOS PRODUTOS"<<endl; cout << "3 --> IMPRIMIR A LISTA DE COMPRA"<< endl; cin >> opcao; system("cls"); } if ((opcao == 2) && (part1 ==0) && (part2==0)) { cout << "OP��O INV�LIDA. N�O FOI CADASTRADO O N�MERO DE PARTICIPANTES."<<endl<<endl; cout << "__________CHURRASCO DA TURMA__________"<<endl<<endl<<endl; cout << "1 --> CADASTRE O N�MERO DE PARTICIPANTES"<<endl; cout << "2 --> CADASTRE O PRE�O DOS PRODUTOS"<<endl; cout << "3 --> IMPRIMIR A LISTA DE COMPRA"<< endl; cin >> opcao; system("cls"); } else if ((opcao <=0) || (opcao >4)) { cout << "OP��O INV�LIDA. DIGITE A OP��O CORRETA."<<endl<<endl; cout << "__________CHURRASCO DA TURMA__________"<<endl<<endl<<endl; cout << "1 --> CADASTRE O N�MERO DE PARTICIPANTES"<<endl; cout << "2 --> CADASTRE O PRE�O DOS PRODUTOS"<<endl; cout << "3 --> IMPRIMIR A LISTA DE COMPRA"<< endl; cin >> opcao; system("cls"); } switch(opcao) { case 1 : { cout << "CADASTRE O N�MERO DE PARTICIPANTES"<<endl<<endl; cout << " PESSOAS QUE BEBEM: "; cin >> part1; cout << " PESSOAS QUE N�O BEBEM: "; cin >> part2; if ((part1 <0) && (part2<0)) { cout << "QUANTIDADE CADASTRADA INV�LIDA. CADASTRE NOVAMENTE." <<endl<<endl; cout << "CADASTRE O N�MERO DE PARTICIPANTES"<<endl; cout << " PESSOAS QUE BEBEM: "; cin >> part1; cout << " PESSOAS QUE N�O BEBEM: "; cin >> part2; } somapart = part1+part2; system("cls"); cout << "RETORNAMOS AO MENU PARA CONTINUAR O CADASTRO OU CORRIGIR A ENTRADA ANTERIOR."<< endl; cout << endl << endl; break; system("cls"); } case 2 : { cout << "CADASTRE O PRE�O DOS PRODUTOS"<<endl<<endl; cout<< endl; cout<< endl; cout << "Cerveja: R$ "; cin >> cerveja; somacv = (part1*6); cout << "Refrigerante normal: R$ "; cin >> refrin; somarn = (part1*0.3) + (part2*1); somarn = ceil(somarn); cout << "Refrigerante diet: R$ "; cin >> refrid; somard = (somapart*0.2); somard = ceil(somard); cout << "Carne de vaca: R$ "; cin >> vaca; somav = (somapart*0.250); cout << "Ling�i�a toscana: R$ "; cin >> lingt; somalt = (somapart*0.050); cout << "Ling�i�a de frango: R$ "; cin >> lingf; somalf = (somapart*0.050); cout << "Lim�o: R$ "; cin >> limao; somal = (somapart*0.050); cout << "Tomate (Vinagrete): R$ "; cin >> tomate; somat = (somapart*0.050); cout << "Cebola (Vinagrete): R$ "; cin >> cebola; somac = (somapart*0.010); cout << "Vinagre: R$ "; cin >> vinagre; somavi = 1; cout << "P�o: R$ "; cin >> pao; somap = (somapart*3); cout << "Carv�o: R$ "; cin >> carvao; somaca = (somapart*0.05); somaca = ceil(somaca); cout << "Sal grosso: R$ "; cin >> sal; somas = (somapart*0.02); somas = ceil(somas); cout << "Detergente: R$ "; cin >> det; somad = 1; cout << "Esponja de pia: R$ "; cin >> esponja; somae = 1; cout << "Papel higi�nico: R$ "; cin >> papelh; somaph = (somapart*0.025); somaph = ceil(somaph); total=(cerveja*somacv)+(refrin*somarn)+(refrid*somard)+(vaca*somav)+(lingt*somalt)+(lingf*somalf)+(limao*somal)+(tomate*somat)+(cebola*somac)+(vinagre*somavi)+(pao*somap)+(carvao*somaca)+(sal*somas)+(det*somad)+(esponja*somae)+(papelh*somaph); margem = total * 1.05; totalb = margem /(part1 + (0.75 * part2)); totalnb = totalb * 0.75; system("cls"); break; } case 3 : { cout << " PRE�OS CADASTRADOS E QUANTIDADE POR PESSOA "; cout << endl; cout << endl; gotoxy(1,2); cout << "Produtos"; gotoxy(30,2); cout << "Pre�os "; gotoxy(40,2); cout << "Quantidades "<< endl; cout << "______________________________________________________________"<< endl; gotoxy(1,5); cout << "Cerveja"; gotoxy(30,5); cout <<"R$ " << cerveja; gotoxy(40,5); cout << somacv << " unidade(s)."; gotoxy(1,6); cout << "Refrigerante normal"; gotoxy(30,6); cout <<"R$ " << refrin; gotoxy(40,6); cout << somarn << " unidade(s)."; gotoxy(1,7); cout << "Refrigerante diet"; gotoxy(30,7); cout <<"R$ " << refrid; gotoxy(40,7); cout << somard << " unidade(s)."; gotoxy(1,8); cout << "Carne de vaca"; gotoxy(30,8); cout <<"R$ " << vaca; gotoxy(40,8); cout << somav << " quilo(s)."; gotoxy(1,9); cout << "Ling�i�a toscana"; gotoxy(30,9); cout <<"R$ " << lingt; gotoxy(40,9); cout << somalt << " quilo(s)."; gotoxy(1,10); cout << "Ling�i�a de frango"; gotoxy(30,10); cout <<"R$ " << lingf; gotoxy(40,10); cout << somalf << " quilo(s)."; gotoxy(1,11); cout << "Lim�o"; gotoxy(30,11); cout <<"R$ " << limao; gotoxy(40,11); cout << somal << " quilo(s)."; gotoxy(1,12); cout << "Tomate (vinagrete)"; gotoxy(30,12); cout <<"R$ " << tomate; gotoxy(40,12); cout << somal << " quilo(s)."; gotoxy(1,13); cout << "Cebola (vinagrete)"; gotoxy(30,13); cout <<"R$ " << cebola; gotoxy(40,13); cout << somac << " quilo(s)."; gotoxy(1,14); cout << "Vinagre"; gotoxy(30,14); cout <<"R$ " << vinagre; gotoxy(40,14); cout << somavi << " unidade."; gotoxy(1,15); cout << "P�o"; gotoxy(30,15); cout <<"R$ " << pao; gotoxy(40,15); cout << somap << " unidade(s)."; gotoxy(1,16); cout << "Carvao"; gotoxy(30,16); cout <<"R$ " << carvao; gotoxy(40,16); cout << somaca << " saco(s)."; gotoxy(1,17); cout << "Sal grosso"; gotoxy(30,17); cout <<"R$ " << sal; gotoxy(40,17); cout << somas << " saco(s)."; gotoxy(1,18); cout << "Detergente"; gotoxy(30,18); cout <<"R$ " << det; gotoxy(40,18); cout << somad << " unidade."; gotoxy(1,19); cout << "Esponja de Pia"; gotoxy(30,19); cout <<"R$ " << esponja; gotoxy(40,19); cout << somae << " unidade."; gotoxy(1,20); cout << "Papel higi�nico"; gotoxy(30,20); cout <<"R$ " << papelh; gotoxy(40,20); cout << somaph << " pacote(s)."; cout << setprecision(2) << fixed; gotoxy(1,22); cout << "Total"; gotoxy(30,22); cout << "R$ " << total; gotoxy(1,23); cout << "Margem de erro de 5%"; gotoxy(30,23); cout << "R$ " << margem; gotoxy(1,24); cout << "Total de pessoa(s)"; gotoxy(30,24); cout << somapart << " pessoa(s)"; cout << endl; cout << "______________________________________________________________"<< endl; gotoxy(1,27); cout << "Total a pagar por pessoa"; gotoxy(1,29); cout << "Quem bebe cerveja"; gotoxy(30,29); cout << "R$ " << totalb; gotoxy(1,30); cout << "Quem n�o bebe cerveja"; gotoxy(30,30); cout << "R$ " << totalnb ; cout<< endl; cout << endl<< endl; cout << "DESEJA RETORNAR AO MENU?? (S/N)"; cin >> retornar; if ((retornar == "s") || (retornar == "S")) system("cls"); else return 0; break; } } //switch } //while return 0; } // int main ()
×
×
  • Criar Novo...