timus221

Untitled

Mar 25th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <windows.h>
  4. #include <conio.h>
  5.  
  6. long signed a = 0;
  7. long signed b = 0;
  8.  
  9. DWORD WINAPI watek1(void *v)
  10. {
  11. while (1)
  12. {
  13. a+=2;
  14. b+=2;
  15. }
  16. }
  17.  
  18. int main(int argc, char *argv[])
  19. {
  20.  
  21.  
  22.  
  23. HANDLE watek_a = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)watek1, 0, 0, 0);
  24.  
  25. for (int i = 1; i<1000; i++)
  26. {
  27. Sleep(200);
  28. printf("a = %d \t b=%d \t r=%d \n", a,b, a-b);
  29.  
  30. if (_kbhit())
  31. {
  32. char w = _getch();
  33. if (w == 32)
  34. //
  35.  
  36. }
  37. }
  38. CloseHandle(watek_a);
  39.  
  40.  
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment