Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. void promedio() {
  6. float elem;
  7. float suma = 0;
  8. int n_elementos = 0;
  9. do {
  10. cin >> elem;
  11. if (elem != -1) {
  12. suma += elem;
  13. n_elementos++;
  14. }
  15. } while (elem != -1);
  16. cout << suma / n_elementos << endl;
  17. }
  18.  
  19.  
  20. void votacion_congreso() {
  21. int N, voto;
  22. int favor=0, contra=0, abstencion=0;
  23.  
  24. cin >> N;
  25. for (int i=0; i < N; i++) {
  26. cout << "Emitir voto:" << endl;
  27. cout << "1. A favor" << endl;
  28. cout << "2. En contra" << endl;
  29. cout << "3. Abstencion" << endl;
  30. cin >> voto;
  31. switch (voto) {
  32. case 1:
  33. favor++;
  34. break;
  35. case 2:
  36. contra++;
  37. break;
  38. case 3:
  39. abstencion++;
  40. break;
  41. }
  42.  
  43. cout << "RESULTADOS" << endl;
  44. cout << "A favor: " << favor << endl;
  45. cout << "En contra: " << contra << endl;
  46. cout << "Abstenciones: " << abstencion << endl;
  47. }
  48.  
  49. }
  50.  
  51.  
  52. void interes() {
  53. float x;
  54. float interes = 0.005;
  55. cin >> x;
  56. for (int i = 0; i < 120; i++) {
  57. x =x*(1+interes);
  58. }
  59. cout << x;
  60.  
  61. }
  62.  
  63.  
  64. void main() {
  65. interes();
  66. system("pause");
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement