Advertisement
Guest User

Untitled

a guest
Jul 7th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. //1 test//
  2. #include <iostream>
  3. #include "supercalc.hpp"
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. SuperCalc<int> sc(1, 11);
  10.  
  11. sc(0, 10) = 0;
  12. for (int i = 0; i < 10; i++) {
  13. sc(0, 10) += sc(0, i);
  14. }
  15.  
  16. for (int i = 0; i < 10; i++) {
  17. int x;
  18. cin >> x;
  19. sc(0, i) = x;
  20. }
  21.  
  22. cout << (int)sc(0, 10) << endl;
  23. return 0;
  24. }
  25. ////////////////////////////////////////////////////
  26. //2 test///
  27. #include <iostream>
  28. #include "supercalc.hpp"
  29.  
  30. using namespace std;
  31.  
  32. int main()
  33. {
  34. SuperCalc<int> sc(1, 3);
  35. sc(0, 2) = -sc(0, 0) * sc(0, 1);
  36. sc(0, 1) = 300 - sc(0, 0);
  37. sc(0, 0) = 100;
  38. cout << (int)sc(0, 2) << endl;
  39. return 0;
  40. }
  41. ///////////////////////////////////
  42. //3 test////
  43. #include <iostream>
  44. #include "supercalc.hpp"
  45.  
  46. using namespace std;
  47.  
  48. int main()
  49. {
  50. SuperCalc<int> sc(1, 3);
  51. sc(0, 2) = (sc(0, 0) + sc(0, 1)) * (sc(0, 0) - sc(0, 1));
  52. sc(0, 1) = 2 * sc(0, 0);
  53. sc(0, 0) = 10;
  54. cout << (int)sc(0, 2) << endl;
  55. sc(0, 0) = 20;
  56. cout << (int)sc(0, 2) << endl;
  57. sc(0, 1) = 5;
  58. cout << (int)sc(0, 2) << endl;
  59. return 0;
  60. }
  61. //////////////////////////////
  62. //4 test///
  63. #include <iostream>
  64. #include "supercalc.hpp"
  65.  
  66. using namespace std;
  67.  
  68. int main()
  69. {
  70. SuperCalc<int> sc(5, 5);
  71. for (int j = 1; j < 5; j++) sc(0, j) = sc(0, j-1) + 1;
  72. for (int i = 1; i < 5; i++) {
  73. for (int j = 0; j < 5; j++) sc(i, j) = sc(i-1, j) + 1;
  74. }
  75.  
  76. sc(0, 0) = 0;
  77. for (int i = 0; i < 5; i++) {
  78. for (int j = 0; j < 5; j++) cout << (int)sc(i, j) << " ";
  79. cout << endl;
  80. }
  81. return 0;
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement