wststreet

LoveC

Feb 14th, 2014
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. int main(int argc, char** argv)
  6. {
  7.     char text[5] = {'0', '0', '0', '0', '\0'};
  8.     int attempts = 0;
  9.  
  10.     while(strcmp(text, "love") != 0)
  11.     {
  12.         text[0] = rand() % 255;
  13.         text[1] = rand() % 255;
  14.         text[2] = rand() % 255;
  15.         text[3] = rand() % 255;
  16.         attempts++;
  17.     }
  18.  
  19.  
  20.     printf("TRUE %s HAS BEEN FOUND and it only took %d attempts\n", text, attempts);
  21.     getchar();
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment