Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Dubz Checker

Name: Anonymous 2012-01-29 15:38

Just made this for you, /prog/

It's on my Github as well!


#include <stdio.h>
#include <stdlib.h>
#define FOREVER for(;;)
#define MAXBASE 16
   
typedef struct house {
    struct house *prev;
    struct house *next;
    unsigned long int value;
    } house;

int BASE = 2;

void check(unsigned long int num) {

    house *first;
 
    first = (house*)malloc(sizeof(house));
    first->prev = NULL;
    first->next = NULL;
    first->value = num;
 
    house *current = first;

    house *aux = first;
 
    FOREVER {
    if(current->value < BASE) {
        goto U_MAD;
        }
    else {
        house *nexthouse;
        nexthouse = (house*)malloc(sizeof(house));
        nexthouse->prev = current;
        nexthouse->next = NULL;
        nexthouse->value = 0;
        current->next = nexthouse;

        while(current->value >= BASE) {
            current->value -= BASE;
            nexthouse->value += 1;
            }

        current = nexthouse;

        }
    }

    U_MAD:

    if(first->value == first->next->value) {

        while(aux->next != NULL) {
            aux = aux->next;
            }

        printf("Base %d : %X",BASE,aux->value);

        while(aux->prev != NULL) {
            aux = aux->prev;
            printf("%X",aux->value);
            }

        printf("\n");

        }

    while(aux->next != NULL) {
        aux = aux->next;
        }

    while(aux != first) {
        aux->prev->next = NULL;
        current = aux->prev;
        free(aux);
        aux = current;
        }
    free(first);
    }

int main(int argc,char **argv) {
    do {
        check(atoi(argv[1]));
        ++BASE;
        }while(BASE <= MAXBASE);
    return EXIT_SUCCESS;
    }

Name: Anonymous 2012-01-29 22:42

>>31
It works fine, and it works across most x86 computers minus anything invented after 1985.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List