Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. typedef struct stArray {
  5. float a[10];
  6. };
  7.  
  8. class dim_class {
  9. private:
  10. stArray array;
  11. stArray array2;
  12. public:
  13. dim_class();
  14. ~dim_class();
  15.  
  16. void dim_data (int *aa);
  17. void dim_show();
  18. int res();
  19. };
  20.  
  21. int main()
  22. {
  23. dim_class prim;
  24.  
  25. prim.dim_class();
  26. prim.dim_data(mm);
  27. prim.res();
  28. return 0;
  29. }
  30.  
  31. dim_class::dim_class() {
  32. for(int i = 0; i < 10; i++) {
  33. array.a[i] = 0;
  34. }
  35. for(int i = 0; i < 10; i++) {
  36. array2.a[i] = 0;
  37. }
  38. }
  39.  
  40. dim_class::~dim_class() {
  41.  
  42. }
  43.  
  44. void dim_class::dim_show() {
  45. for (int i = 0; i < 10; i++) {
  46. cout << "Значение переменной a[" << i << "] равно " << a[i] << endl;
  47. }
  48. }
  49.  
  50. void dim_class::dim_data(int *aa) {
  51. for (int i = 0; i < 10; i++) {
  52. *(array.a + i) = *(aa + i);
  53. }
  54. }
  55.  
  56. int dim_class::res() {
  57. int res=0;
  58. for (int i = 0; i < 10; i++) {
  59. for (int j = 0; j < 10; j++) {
  60. if(array.a[i] != array2.a[j]) {
  61. cout << "array.a[" << i << "] = " << array.a[i] << " [ != ] " << "array2.a[" << j << "] = " << array2.a[j] << endl;
  62. }
  63. }
  64. }
  65. return res;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement