Calculadora Prog 1
#include
#include
#include
#include
int main()
{
float res,n1,n2,res1; int i,fat,c,a,b,dec,cont,dec1,tam,soma=0,x=0; int bin[20]; int quociente[20]; int resto[20]; char binC[20]; int binInt[20]; int pot[20];
char des,op,exp; system("color 27"); des!='|'; system("title CALCULADORA - FUNCOES BASICAS"); while((des!='|') && (op!='S')){ printf("\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\xBB"); printf("\n\t\t\t\xBA C A L C U L A D O R A\xBA"); printf("\n\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\xBc"); printf("\n\n\t(+) - soma\t\t\t(P) - Porcentagem \n" ); printf("\t(-) - Subtracao\t\t\t(F) - Fatorial \n"); printf("\t(*) - Multiplicao\t\t(B) - Conversao Binario -> Decimal \n"); printf("\t(/) - Divisao\t\t\t(D) - Conversao Decimal -> Binario \n"); printf("\t(E) - Exponenciacao\t\t(S) - Sair \n"); printf("\t(R) - Raiz Quadrada: \n");
fflush(stdin); //Limpando entradas do teclado printf(" Opcao: "); scanf("%c",&op); op=toupper(op); //convertendo OP para Maiusculo if ((op=='+') || (op=='-') || (op=='*') || (op=='/') || (op=='E') || (op=='F') || (op=='R') || (op=='P') || (op=='B') || (op=='D') ) //Verificacao se valor digitado pertence a algumas das operacoes do MENU. { switch(op) { case '+': printf("\n\tA D I C A O\n"); printf("\n\tDigite o Primeiro Valor: "); scanf("%f",&n1); printf("\tDigite o Segundo Valor: "); scanf("%f",&n2); res=n1+n2; printf("\n\t%9.2f + %9.2f = %9.2f",n1,n2,res); break; case '-': printf("\n\tS U B T R A C A O O\n\n");