William Luis

0 %
William Luis
Fullstack Developer
  • Residence:
    Canada
  • City:
    Toronto
  • Age:
    26
French
English
Spanish
html
CSS
Js
PHP
WordPress
  • Bootstrap, Materialize
  • Stylus, Sass, Less
  • Gulp, Webpack, Grunt
  • GIT knowledge

Calculadora C++ com Switch

25 de outubro de 2015

Captura de tela 2015-10-25 10.07.21Calculadora feito usando o Switch.

[sourcecode language=”C”]
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<math.h>

main()
{
float vl1,vl2,r;
char sbl;

for(;;)
{

printf("Digites uns do simbolos das operacoes(+,-,/,*)");
scanf("%c",&sbl);
printf("\nDigite o primeiro valor:");
scanf("%f",&vl1);
printf("\nDigite o segundo valor:");
scanf("%f",&vl2);
switch (sbl)
{
case ‘+’:
{
r = vl1 + vl2;
printf("sua resposta eh: %.f\n",r);
break;
}
case ‘-‘:
{
r = vl1 – vl2;
printf("sua resposta eh: %.f\n",r);
break;
}
case ‘*’:
{
r = vl1 * vl2;
printf("sua resposta eh: %.f\n",r);
break;
}
case ‘/’:
{
r = vl1 / vl2;
printf("sua resposta eh: %.f\n",r);
break;
}
default:
{
printf("comando invalido\n");
}
}
}
}
[/sourcecode]

Fonte+Exe: https://williamluis.box.com/s/dip4ux1ipyl8he1of3q0wamsek5x9uf0

Posted in C++, Calculadora, Dicas, Faculdade
Write a comment