Advertisement
idsystems

Cpp_Practica 19 - Millonario

Jan 26th, 2012
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. // Program: millonario.cc
  2. // Author:  Yoan Pinzon
  3. // Date:    Agosto 30, 2006
  4.  
  5. #include <iostream>
  6. #include <iomanip>
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12.    double valor, carlos, jose, martha;
  13.  
  14.    cout << "Testamento" << endl;
  15.    cout << "==========" << endl;
  16.  
  17.    cout << "Entre el valor a repartir = "; cin >> valor;
  18.  
  19.    carlos = 1.0/3.0 * valor;
  20.    jose = 4.0/3.0 * carlos;
  21.    martha = 1.0/2.0 * jose;
  22.  
  23.    cout.setf(ios::fixed);
  24.    cout << setprecision(2);
  25.  
  26.    cout << "A Carlos le corresponde " << valor/3 << endl;
  27.    cout << "A Jose le corresponde " << jose << endl;
  28.    cout << "A Martha le corresponde " << martha << endl;
  29.  
  30.    return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement