Guest User

Untitled

a guest
Apr 24th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include <cstdlib>
  5.  
  6. using namespace std;
  7.  
  8. const int MEMBERS = 1000;
  9. const string ALPHA[] = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
  10.  
  11. int main() {
  12.  
  13. srand ( 12345 );
  14.  
  15. string tiedosto = "omatesti.in";
  16.  
  17. ofstream virta(tiedosto.c_str());
  18.  
  19. for (int i = 0; i <= MEMBERS; i++) {
  20.  
  21. virta << "A" << " " << i << " " << i << " asd" << endl;
  22.  
  23. }
  24.  
  25. for (int i = 0; i <= MEMBERS - 1; i++) {
  26.  
  27. virta << "R" << " " << "F " << i << " " << i+1 << " relationship" << endl;
  28.  
  29. }
  30.  
  31. int i1 = 0;
  32. int i2 = 0;
  33.  
  34. for (int i = 0; i <= 5 * MEMBERS; i++) {
  35.  
  36.  
  37. i1 = rand() % (MEMBERS + 1);
  38. i2 = rand() % (MEMBERS + 1);
  39.  
  40. virta << "R" << " " << "K " << i1 << " " << i2 << " random relationship" << endl;
  41.  
  42. }
  43.  
  44. for (int i = 0; i <= 5 * MEMBERS; i++) {
  45.  
  46.  
  47. i1 = rand() % (MEMBERS + 1);
  48. i2 = rand() % (MEMBERS + 1);
  49.  
  50. virta << "S " << i1 << " " << i2 << endl;
  51.  
  52. }
  53.  
  54. for (int i = 0; i <= MEMBERS; i++) {
  55.  
  56.  
  57. virta << "F " << i << endl;
  58.  
  59. }
  60.  
  61. string randnetwork = "";
  62.  
  63. for (int i = 0; i <= MEMBERS/2; i++) {
  64.  
  65. randnetwork = ALPHA[rand() % 26];
  66. randnetwork.append(ALPHA[rand() % 26]);
  67.  
  68. virta << "N " << randnetwork << endl;
  69.  
  70. for (int j = 0; j <= MEMBERS/10; j++) {
  71.  
  72. i1 = rand() % (MEMBERS + 1);
  73. virta << "J " << i1 << " " << randnetwork << endl;
  74. }
  75.  
  76. virta << "P N " << randnetwork << endl;
  77.  
  78.  
  79. }
  80.  
  81. for (int i = 0; i <= MEMBERS-1; i++) {
  82.  
  83. i1 = rand() % (MEMBERS + 1);
  84. i2 = rand() % (MEMBERS + 1);
  85.  
  86. virta << "I K " << i1 << " " << i2 << endl;
  87.  
  88. }
  89.  
  90. for (int i = 0; i <= MEMBERS-1; i++) {
  91.  
  92. virta << "P P " << i << endl;
  93.  
  94. }
  95.  
  96. virta << "Q" << endl;
  97.  
  98. return 0;
  99.  
  100. }
Add Comment
Please, Sign In to add comment