fork download
  1. #include <vector>
  2. #include <thread>
  3.  
  4. std::vector<std::string> HostsToConnectTo;
  5.  
  6. unsigned int CurrA = 10;
  7. unsigned int CurrB = 0;
  8. unsigned int CurrC = 0;
  9. unsigned int CurrD = 0;
  10. int mainloop = 0;
  11.  
  12. void ThreadConnector(std::string host, int port, std::string nickname, bool only_incomming_connection)
  13. {
  14. RakClientConnector * current = new RakClientConnector();
  15. current->run(host, port, nickname, only_incomming_connection, 0);
  16. }
  17.  
  18. int main()
  19. {
  20. int lastpercent = 0;
  21. while (mainloop++ <= 3000)
  22. {
  23. if (++CurrD == 254)
  24. {
  25. CurrD = 1;
  26. if (++CurrC == 254)
  27. {
  28. CurrC = 0;
  29. ++CurrB;
  30. }
  31. }
  32. HostsToConnectTo.push_back(string_format("%d.%d.%d.%d", CurrA, CurrD, CurrB, CurrC ));
  33. system(("netsh interface ip add address \"VIRT\" " + HostsToConnectTo .back() + " 255.0.0.0").c_str());
  34. int percent = mainloop / 30;
  35. if (lastpercent != percent)
  36. {
  37. lastpercent = percent;
  38. std::cout << percent << "%" << std::endl;
  39. }
  40. }
  41. for (auto i : HostsToConnectTo)
  42. {
  43. new std::thread(ThreadConnector, i, 7777, i, false);
  44. }
  45. while (1)
  46. {
  47. Sleep(1000);
  48. }
  49. return 0;
  50. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘void ThreadConnector(std::string, int, std::string, bool)’:
prog.cpp:14:2: error: ‘RakClientConnector’ was not declared in this scope
  RakClientConnector * current = new RakClientConnector();
  ^
prog.cpp:14:23: error: ‘current’ was not declared in this scope
  RakClientConnector * current = new RakClientConnector();
                       ^
prog.cpp:14:37: error: expected type-specifier before ‘RakClientConnector’
  RakClientConnector * current = new RakClientConnector();
                                     ^
prog.cpp:14:37: error: expected ‘;’ before ‘RakClientConnector’
prog.cpp: In function ‘int main()’:
prog.cpp:32:86: error: ‘string_format’ was not declared in this scope
   HostsToConnectTo.push_back(string_format("%d.%d.%d.%d", CurrA, CurrD, CurrB, CurrC ));
                                                                                      ^
prog.cpp:38:4: error: ‘cout’ is not a member of ‘std’
    std::cout << percent << "%" << std::endl;
    ^
prog.cpp:38:35: error: ‘endl’ is not a member of ‘std’
    std::cout << percent << "%" << std::endl;
                                   ^
prog.cpp:47:13: error: ‘Sleep’ was not declared in this scope
   Sleep(1000);
             ^
stdout
Standard output is empty