fork(4) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. float TFrm_Main::GetMemoryTotalPhys()
  5. {
  6. TMemoryStatus *ms = new TMemoryStatus(); //this is in borland
  7. GlobalMemoryStatus(ms);
  8. int dw_Len = ms->dwLength;
  9. int dw_memLoad = ms->dwMemoryLoad;
  10. unsigned long dw_TotPhyMem = ((ms->dwTotalPhys/1024.0)); //1024 is used to convert byte to kilobyte here
  11. unsigned long dw_AvailPhyMem = ((ms->dwAvailPhys/1024.0));
  12. unsigned long dw_TotPgFile = ((ms->dwTotalPageFile/1024.0));
  13. unsigned long dw_AvailPgfile = ((ms->dwAvailPageFile/1024.0));
  14. unsigned long dw_TotVirMem = ((ms->dwTotalVirtual/1024.0));
  15. unsigned long dw_AvailVirMem = ((ms->dwAvailVirtual/1024.0));
  16. unsigned long tot_Commit = (dw_TotPgFile/1024.0);
  17. unsigned long use_Commit = ((dw_TotPgFile-dw_AvailPgfile)/1024.0);
  18. delete ms;
  19. return((use_Commit/(float)tot_Commit)*100.0);
  20. }
  21.  
  22. int main() {
  23. int lP;
  24. int lM;
  25. int status;
  26. int suma;
  27. int i, j, k;
  28. const int max = 150;
  29.  
  30. cin >> lP;
  31.  
  32. for (i = 1; i <= lP; i++ )
  33. {
  34. cin >> lM;
  35. char tablica [max] [max];
  36. for (j = 1; j <= lM; j++)
  37. {
  38. for (k = 1; k <= lM; k++)
  39. {
  40. cin >> tablica[ j ] [ k ];
  41. }
  42. }
  43.  
  44. suma = 0;
  45. for(j = 1; j <= lM; j++)
  46. {
  47. status = 1;
  48. for (k = 1; k <= lM; k++)
  49. {
  50. if (j + k <= lM)
  51. {
  52. if (tablica[k][j+k] == '0')
  53. status = 0;
  54.  
  55. }
  56. else if (tablica[k][k+j-lM] == '0')
  57. status = 0;
  58. }
  59. if(status == 1)
  60. suma = suma + 1;
  61. }
  62. cout << suma << endl;
  63.  
  64.  
  65. }
  66.  
  67. cout << GetMemoryTotalPhys();
  68. return 0;
  69. }
Compilation error #stdin compilation error #stdout 0s 39528KB
stdin
2
4
0 1 1 1
1 0 1 1
1 1 0 1
1 1 1 0
4
0 1 1 0
1 0 0 1
1 0 0 1
0 1 1 0
compilation info
prog.cpp:4:7: error: ‘TFrm_Main’ has not been declared
 float TFrm_Main::GetMemoryTotalPhys()
       ^~~~~~~~~
prog.cpp: In function ‘float GetMemoryTotalPhys()’:
prog.cpp:6:5: error: ‘TMemoryStatus’ was not declared in this scope
     TMemoryStatus *ms = new TMemoryStatus(); //this is in borland
     ^~~~~~~~~~~~~
prog.cpp:6:20: error: ‘ms’ was not declared in this scope
     TMemoryStatus *ms = new TMemoryStatus(); //this is in borland
                    ^~
prog.cpp:6:29: error: expected type-specifier before ‘TMemoryStatus’
     TMemoryStatus *ms = new TMemoryStatus(); //this is in borland
                             ^~~~~~~~~~~~~
prog.cpp:7:26: error: ‘GlobalMemoryStatus’ was not declared in this scope
     GlobalMemoryStatus(ms);
                          ^
prog.cpp:18:12: error: type ‘<type error>’ argument given to ‘delete’, expected pointer
     delete ms;
            ^~
stdout
Standard output is empty