Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 4th, 2012  |  syntax: None  |  size: 2.24 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Array size limits
  2. #include <iostream>
  3. #include <fstream>
  4. #include <windows.h>
  5.  
  6. #pragma warning (disable : 4820 4619 4668 4101)
  7.  
  8. HANDLE ghEvents;
  9.  
  10. const int arc = 2048;
  11. const int are = 8192;
  12.  
  13. struct DataStructure_init {
  14.  
  15.     int main_seq[are][32];
  16.     int main_seq2[are][32];
  17.     int main_seq3[are][32];
  18.     int main_lim[are];
  19.  
  20. };
  21.  
  22. struct DataStructure_trus {
  23.     int net[arc];
  24.     int  r6[arc];
  25.     int thr[arc];
  26. };
  27.  
  28. int ftrus (unsigned char cmain[],int array_inst[],DataStructure_trus& va);
  29. int finit (DataStructure_trus va,DataStructure_init& in);
  30.  
  31. using namespace std;
  32.  
  33. int main()
  34. {
  35.     unsigned char cmain[are];
  36.     int array_inst[64]={0};
  37.     DataStructure_trus va;
  38.     DataStructure_init in;
  39.     ftrus(cmain,array_inst,va);
  40.     finit(va,in);
  41.  
  42.     cin.get();
  43. }
  44.  
  45.  
  46.  
  47. int finit (DataStructure_trus va,DataStructure_init& in)
  48. {
  49.  
  50.     int nb=0,flag=0,lock=0;
  51.  
  52.     for(int i=0;i<are;i++){
  53.  
  54.         for(int j=0;j<24;j++){
  55.         in.main_seq[i][j]=va.thr[(i*24)+j];
  56.         }
  57.  
  58.     }
  59.  
  60.     return 0;
  61. }
  62.  
  63.  
  64.  
  65. int ftrus (unsigned char cmain[],int array_inst[],DataStructure_trus& va)
  66. {
  67.  
  68.     int g=0;
  69.     ifstream in("C:\Dev-Cpp\DCS\Decom\trus.txt", ios::binary);
  70.     unsigned char c;
  71.     while( in.read((char *)&c, 1) )
  72.     {      
  73.             cmain[g]=c;
  74.             if(cmain[g]==' ' && cmain[g-1]=='t' && cmain[g-2]=='e' && cmain[g-3]=='n')      {array_inst[1]=g+1;}
  75.             else if(cmain[g]==' ' && cmain[g-1]=='r' && cmain[g-2]=='h' && cmain[g-3]=='t') {array_inst[9]=g+1;array_inst[21]=g-7;}
  76.             g++;
  77.     }
  78.     array_inst[29]=g-2;
  79.  
  80.     for(int i=0;i<64;i++){va.r6[i]=0;}
  81.  
  82.     for(int i=array_inst[1];i<array_inst[21];i++){
  83.         if(cmain[i]=='1'){va.net[va.r6[1]]=1;va.r6[1]++;}
  84.                     else {va.net[va.r6[1]]=0;va.r6[1]++;}
  85.     }
  86.  
  87.     for(int i=array_inst[9];i<array_inst[29];i++){
  88.         if(cmain[i]=='1'){va.thr[va.r6[9]]=1;va.r6[9]++;}
  89.                     else {va.thr[va.r6[9]]=0;va.r6[9]++;}
  90.     }
  91.  
  92.  
  93.     return 0;
  94. }
  95.        
  96. unsigned char cmain[are];
  97. int array_inst[64]={0};
  98. DataStructure_trus va;
  99. DataStructure_init in;
  100.  
  101. int main() {
  102.    ftrus(cmain,array_inst,va);
  103.    finit(va,in);
  104.    cin.get();
  105.  }
  106.        
  107. unsigned char* cmain = new unsigned char[are];
  108.        
  109. std::vector<unsigned char> cmain(are);
  110.        
  111. static DataStructure_trus va;
  112. static DataStructure_init in;