wonman

Untitled

Feb 12th, 2015
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4. #include <cmath>
  5. #include <cstdlib>
  6. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  7.  
  8.  
  9. using namespace std;
  10.  
  11. int main(int argc, char** argv) {
  12.  
  13. string table[100];
  14.  
  15. table[100] = argv[1];
  16. int z;
  17. int i;
  18.  
  19. for(i=0; i<100; i++)
  20. {
  21.    
  22.     if(table[i] == ",")
  23.     {
  24.         z = i;
  25.     }
  26. }
  27.  
  28. int tab1[z]; //wielkosc tabelki do przecinka
  29. int tab2[i-z]; //wielkosc tabelki od przcinka do konca i (100)
  30.  
  31. for(int s= 0; s<z; s++)
  32. {
  33.      tab1[s]=atoi(table[s].c_str()) ;
  34.    
  35.     // atoi(str.c_str());
  36. }
  37.  
  38. for(int s= z; s<i; s++)
  39. {
  40.      tab2[s]=atoi(table[s].c_str()) ;
  41.    
  42. }
  43.  
  44.  
  45. ofstream OUT;
  46. OUT.open("liczby.txt" , ios::out);
  47.  
  48.  
  49. for(int s=0; s<100; s++)
  50. {
  51.     for(int j=0; j<100; j++)
  52.     {
  53.         if( tab1[j] == tab2[s])
  54.         {
  55.             OUT<< tab1[s];
  56.             s++; // zeby liczby sie nie potwaraly????????????
  57.         }
  58.     }
  59. }
  60.  
  61.  
  62. OUT.close(); //poprawnie?
  63.  
  64. return 0;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment