Advertisement
saroow

Untitled

Mar 6th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.21 KB | None | 0 0
  1. // ConsoleApplication2.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <fstream>
  7. #include <stdio.h>
  8. #include <string>
  9.  
  10.  
  11. using namespace std;
  12.  
  13. int main() {
  14.     int arr[3], digitsFirst[6], digitsSecond[6];
  15.     for (int i = 0; i < 3; i++) {
  16.         cout << "arr[" << i << "]= ";
  17.         cin >> arr[i];
  18.     }
  19.  
  20.  
  21.     for (int i = 1; i <= 3; i++) {
  22.         for (int j = 0; j < 6; j++) {
  23.             digitsFirst[j] = arr[i - 1] % 10;
  24.             arr[i - 1] = arr[i - 1] / 10;
  25.             //cout << digitsFirst[j]<<"\n";
  26.             digitsSecond[j] = arr[i] % 10;
  27.             arr[i] = arr[i] / 10;
  28.             //cout << digitsSecond[j];
  29.         }
  30.  
  31.  
  32.         for (int j = 0; j < 6; j++) {
  33.             cout << digitsFirst[j];
  34.         }
  35.  
  36.         cout << "\n";
  37.  
  38.         for (int j = 0; j < 6; j++) {
  39.             cout << digitsSecond[j];
  40.         }
  41.         cout << "\n";
  42.         for (int j = 1; j <= 6; j++) {
  43.             /*if (digitsFirst[j - 1] == digitsSecond[j]) {
  44.                 cout << "collision \n";
  45.             }*/
  46.  
  47.            
  48.         }
  49.     }
  50.  
  51.     return 0;
  52. }
  53.  
  54.  
  55.  
  56.  
  57. //
  58. //int main()
  59. //{
  60. //  string word;
  61. //  ifstream myfile("example.txt");
  62. //
  63. //  ofstream output;
  64. //  output.open("output.txt");
  65. //
  66. //  if (myfile.is_open())
  67. //  {
  68. //      while (myfile >> word)
  69. //      {
  70. //          if (word.find('x') != std::string::npos)
  71. //          {
  72. //              output << word << " ";
  73. //          }
  74. //      }
  75. //     
  76. //      myfile.close();
  77. //  }
  78. //
  79. //  else cout << "Unable to open file";
  80. // 
  81. //
  82. //  return 0;
  83. //}
  84. //
  85.  
  86.  
  87.  
  88. //int* sortArr(int *arr, int len) {
  89. //  for (int i = 1; i < len; i++) {
  90. //      for (int j = 0; j < len; j++) {
  91. //          if (arr[i] > arr[j]) {
  92. //              int temp = arr[i];
  93. //              arr[i] = arr[j];
  94. //              arr[j] = temp;
  95. //          }
  96. //      }
  97. //  }
  98. //
  99. //  return arr;
  100. //}
  101. //
  102. //int arr1[10], arr2[5];
  103. //for (int i = 0; i < 10; i++) {
  104. //cout << "arr1[" << i << "]= ";
  105. //cin >> arr1[i];
  106. //}
  107. //
  108. //for (int i = 0; i < 5; i++) {
  109. //cout << "arr2[" << i << "]= ";
  110. //cin >> arr2[i];
  111. //}
  112. //
  113. //sortArr(arr1, 10);
  114. //sortArr(arr2, 5);
  115. //
  116. //for (int i = 0; i < 5; i++) {
  117. //cout << arr1[i];
  118. //}
  119. //
  120. //ofstream myfile;
  121. //myfile.open("example.txt");
  122. //myfile << "First array: \n";
  123. //
  124. //for (int i = 0; i < 10; i++) {
  125. //myfile << arr1[i]<<" ";
  126. //}
  127. //
  128. //myfile << "Second array: \n";
  129. //for (int i = 0; i < 5; i++) {
  130. //myfile << arr2[i] << " ";
  131. //}
  132. //
  133. //myfile.close();*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement