Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. #define MAX_REGIONS_COUNT 10
  6. #define MAX_RESULTS_COUNT 10
  7.  
  8. int main(void)
  9. {
  10. FILE *File = fopen("F:/Folder/input.vgp", "ab");
  11. FILE* Input = 0;
  12. if (File)
  13. {
  14. std::srand(std::time(0));
  15. int RegionsCount = rand() % MAX_REGIONS_COUNT;
  16. int OutputSize = 0;
  17. int SeenAnswers = 0;
  18. for (int Region = 0; Region < RegionsCount; Region++)
  19. {
  20. int ResultsCount = rand() % MAX_RESULTS_COUNT;
  21. if (ResultsCount == 0)
  22. {
  23. ResultsCount = 1;
  24. }
  25. int Results[MAX_RESULTS_COUNT + 1];
  26. Results[0] = ResultsCount;
  27.  
  28. for (int ResultIndex = 1; ResultIndex <= ResultsCount; ResultIndex++)
  29. {
  30. int Result = rand() % 150 + 150;
  31. Results[ResultIndex] = Result;
  32. }
  33. fwrite(Results, (ResultsCount + 1) * sizeof(int), 1, File);
  34. }
  35.  
  36. if (!Input)
  37. {
  38. Input = fopen("F:/Folder/output.vgp", "r");
  39. }
  40. else
  41. {
  42. //fread(, , , Input);
  43. }
  44.  
  45. fclose(File);
  46. }
  47.  
  48. system("PAUSE");
  49. return(0);
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement