daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest May 16th, 2018 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cstring>
  3. #define uint32 unsigned int
  4.  
  5. using namespace std;
  6.  
  7. static char map[] = "abcdefghjklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890";
  8. static uint32 lenMap = strlen(map);
  9. static char current[] = "00";
  10.  
  11. int find(const char* str, const char* fnd)
  12. {
  13.  
  14.     for (uint32 x = 0; x < strlen(str); x++)
  15.     {
  16.         char chr = (char)str[x];
  17.         if (strncmp(&chr, fnd, 1 ) == 0)
  18.             return x;
  19.     }
  20.     return -1;
  21. }
  22.  
  23. void incWord(char* word)
  24. {
  25.     static uint32 wordLen = strlen(word)-1;
  26.     for(uint32 i = wordLen;i>=0;i--)
  27.     {
  28.         int pos = find(map,&word[i])+1;
  29.         if (pos == lenMap)
  30.         {
  31.             word[i] = map[0];
  32.          //   cout << word << " " << pos << lenMap << endl;
  33.             if (i==0)
  34.             {
  35.                 char newChar = (char)map[0];
  36.                 strcat(word,&newChar);
  37.             }
  38.         }
  39.         else
  40.         {
  41.                 word[i] = map[pos];
  42.                 return;
  43.         }
  44.     }
  45. }
  46.  
  47.  
  48.  
  49. int main()
  50. {
  51.     while(true){
  52.         incWord(current);
  53.         cout <<"!"<< current<<"!"<<endl;
  54.        }
  55.     return 0;
  56. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top