Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #define uint32 unsigned int
- using namespace std;
- static char map[] = "abcdefghjklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890";
- static uint32 lenMap = strlen(map);
- static char current[] = "00";
- int find(const char* str, const char* fnd)
- {
- for (uint32 x = 0; x < strlen(str); x++)
- {
- char chr = (char)str[x];
- if (strncmp(&chr, fnd, 1 ) == 0)
- return x;
- }
- return -1;
- }
- void incWord(char* word)
- {
- static uint32 wordLen = strlen(word)-1;
- for(uint32 i = wordLen;i>=0;i--)
- {
- int pos = find(map,&word[i])+1;
- if (pos == lenMap)
- {
- word[i] = map[0];
- // cout << word << " " << pos << lenMap << endl;
- if (i==0)
- {
- char newChar = (char)map[0];
- strcat(word,&newChar);
- }
- }
- else
- {
- word[i] = map[pos];
- return;
- }
- }
- }
- int main()
- {
- while(true){
- incWord(current);
- cout <<"!"<< current<<"!"<<endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment