Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. // Referencias.cpp
  2. // Mostra passagem de argumentos por referência
  3.  
  4. void reajusta20( float& preco, float& rajuste);
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. void reajusta20( float& preco, float& rajuste){
  10. rajuste = preco * 0.2;
  11. preco *= 1.2;
  12. }
  13. int main ()
  14. {
  15.  
  16. float val_preco, val_reaj;
  17.  
  18. cout << "Insira o preco atual: ";
  19. cin >> val_preco;
  20. if(val_preco <= 0) {
  21. cout << "Nao e possivel fazer essa operacao";
  22. system("PAUSE");
  23. return 0;
  24. }
  25. else {
  26. reajusta20(val_preco, val_reaj);
  27. cout<< "O preco novo e: " << val_preco << endl;
  28. cout<< "O aumento foi de " << val_reaj << endl;
  29. }
  30.  
  31. system("PAUSE");
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement