Advertisement
alduncin

numero.cpp

Feb 9th, 2012
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. #include "Numero.h"
  4.  
  5. int main (void)
  6. {
  7.   int n,d,n1,d2;
  8.   cout<<"a.Numerador";
  9.   cin >>n;
  10.   cout <<"a.Denominador";
  11.   cin >>d;
  12.   cout <<"b.Numerador";
  13.   cin >>n1;
  14.   cout >>"b.Denominador";
  15.   cin >> d1;
  16.  
  17.   numero a(n,d),b(n1,d1),c;
  18.   c=a+b;
  19.   a.ToPrint();
  20.   cout << "+";
  21.   b.Toprint();
  22.   cout <<"=";
  23.   c=a+b;
  24.   c.To.Print();
  25.   cout <<endl;
  26.   c=a*b;
  27.   c.ToPrint();
  28.   cout <<endl;
  29.   return 0;
  30. }
  31.  
  32.  
  33. /*el de el pdf
  34. /*
  35. Programa: Numero.cpp
  36. Autor: Carlos Bernardo Garza Treviño
  37. Fecha: 02/02/12
  38. */
  39. #include <iostream>
  40. using namespace std;
  41. #include "Numero.h"
  42. int main( void )
  43. {
  44. int n, d, n1, d1;
  45. cout << "a.Numerador ";
  46. cin >> n;
  47. cout << "a.Denominador ";
  48. cin >> d;
  49. cout << "b.Numerador ";
  50. cin >> n1;
  51. cout << "b.Denominador ";
  52. cin >> d1;
  53. Numero a(n,d), b(n1,d1), c;
  54. a.ToPrint();
  55. cout << " + ";
  56. b.ToPrint();
  57. cout << " = ";
  58. c = a + b;
  59. c.ToPrint();
  60. cout << endl;
  61. c = a * b;
  62. c.ToPrint();
  63. cout << endl;
  64. return 0;
  65. }
  66.  
  67. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement