fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int item, qtde;
  6. float valor;
  7. cin >> item >> qtde;
  8. switch (item) {
  9. case 1:
  10. valor = 4.00;
  11. break;
  12. case 2:
  13. valor = 4.50;
  14. break;
  15. case 3:
  16. valor = 5.00;
  17. break;
  18. case 4:
  19. valor = 2.00;
  20. break;
  21. case 5:
  22. valor = 1.50;
  23. break;
  24. }
  25. cout << "Total: R$" << valor * qtde;
  26. }
  27.  
  28. //https://pt.stackoverflow.com/q/322871/101
Success #stdin #stdout 0s 4524KB
stdin
3 2
stdout
Total: R$10