Trabalho
#include
#include
#include
int main ()
{
system("title Calculadora para ATPS Parte I"); // inserindo titulo printf("\n"); system("color FC"); // deixando a cor do programa Branco com escrita vermelha printf("\t\t\t\t\xC9\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xBB\n");//desenhar o quadro printf("\t\t\t\t\xBA C A L C U L A D O R A \xBA\n"); printf("\t\t\t\t\xC8\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xBC\n"); printf("\n\n"); char op;// variavel caracter para identificar a operacao float val1,val2,res,cont;//variaveis para os calculos for(cont=0;op!='S';cont++) { printf( "\n (+) - Soma " "\n (-) - Subtracao " "\n (*) - Multiplicacao " "\n (/) - Divisao " "\n (E) - Exponenciacao" "\n (R) - Raiz quadrada" "\n (P) - Porcentagem" "\n (F) - Fatorial" "\n (B) - Conversao Binario -> Decimal" "\n (D) - Conversao Decimal -> Binario" "\n (S) - Sair" "\n Opcao:");//Menu da calculadora
op=getche();//Mostrar opçao escolhida sem acionar o enter switch(op)//escolher um caso
{
case '+' : printf ("\n\n S O M A"); printf("\n\n Primeiro valor:"); scanf("%f",&val1); printf("\n Segundo valor:"); scanf("%f",&val2); res=(val1+val2); printf("\n %.2f + %.2f = %.2f\n\n",val1,val2,res); system("cls"); break;
case '-' : printf ("\n\n S U B T R A C A O"); printf("\n\n Primeiro valor:"); scanf("%f",&val1); printf("\n Segundo valor:"); scanf("%f",&val2); res=(val1-val2); printf("\n %.2f - %.2f = %.2f\n\n",val1,val2,res); system("cls"); break;
case '*' :