fork(2) download
  1.  
  2. #include "stdafx.h"
  3. #include <conio.h>
  4. #include <iostream>
  5. #include <string>
  6. #include <fstream> //in off stream
  7. #include <cstdlib> //exit(), rand()
  8. #include <ctime> //time();
  9.  
  10. using namespace std;
  11.  
  12. void random(int t1[], int t2[], const int s)
  13. {
  14. for (int a = 0; a < s; ++a)
  15. {
  16. t1[a] = rand();
  17. }
  18.  
  19. for (int a = 0; a < s; ++a)
  20. {
  21. t2[a] = rand();
  22. }
  23. }
  24.  
  25.  
  26. void tablice(int t1[], int t2[], const int s)
  27. {
  28.  
  29. for (int a = 0; a < s; ++a)
  30. {
  31. t2[a] = t1[a];
  32. }
  33. }
  34.  
  35. void wskazniki(int *t1, int *t2, const int s)
  36. {
  37.  
  38. for (int a = 0; a < s; ++a)
  39. {
  40. *(t2 + a) = *(t1 + a);
  41. }
  42. }
  43.  
  44. void display(int t1[], int t2[], const int s)
  45. {
  46. for (int a = 0; a < s; ++a)
  47. {
  48. cout << "tablica1: " << t1[a] << "\t\ttablica2: " << t2[a] << endl;
  49. }
  50. }
  51.  
  52. int _tmain(int argc, _TCHAR* argv[])
  53. {
  54. srand(time(NULL));
  55.  
  56. const int size = 10;
  57.  
  58. int ein[size] = { 0 };
  59. int zwei[size] = { 0 };
  60.  
  61. cout << "\n\nrandomowanie wstepne--------------------" << endl;
  62. random(ein, zwei, size);
  63. display(ein, zwei, size);
  64.  
  65. cout << "\n\nmetoda z uzyciem tablic---------------------------" << endl;
  66. tablice(ein, zwei, size);
  67. display(ein, zwei, size);
  68.  
  69. cout << "\n\nznowu randomowanie--------------------" << endl;
  70. random(ein, zwei, size);
  71. display(ein, zwei, size);
  72.  
  73. cout << "\n\nmetoda z uzyciem wskaznikow---------------------------" << endl;
  74. wskazniki(ein, zwei, size);
  75. display(ein, zwei, size);
  76.  
  77.  
  78.  
  79. _getch();
  80. return 0;
  81. }
  82.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:20: fatal error: stdafx.h: No such file or directory
 #include "stdafx.h"
                    ^
compilation terminated.
stdout
Standard output is empty