fork download
  1. #include <windows.h>
  2. #include <iostream>
  3. #include <fstream>
  4. #include <string>
  5.  
  6. #define ADDITION 1
  7. #define MULTIPLICATION 2
  8. #define SUBSTRACTION 3
  9.  
  10. HANDLE hSemaphore;
  11. volatile double shared_resource;
  12.  
  13. DWORD WINAPI calculate(LPVOID arg)
  14. {
  15. std::ifstream file((char *)arg);
  16. int operation, number;
  17. double acc = 0;
  18.  
  19. file >> operation;
  20. file >> acc;
  21. while (file >> number)
  22. {
  23. switch (operation)
  24. {
  25. case ADDITION:
  26. acc += number;
  27. break;
  28. case MULTIPLICATION:
  29. acc *= number;
  30. break;
  31. case SUBSTRACTION:
  32. acc -= number;
  33. break;
  34. default:
  35. break;
  36. }
  37. }
  38. ReleaseSemaphore(hSemaphore, 1, NULL);
  39. return 0;
  40. }
  41.  
  42. int main()
  43. {
  44.  
  45. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:21: fatal error: windows.h: No such file or directory
compilation terminated.
stdout
Standard output is empty