#!/usr/bin/env cscript #include <math.h> #include <stdio.h> #include <string.h> #include <strings.h> #define ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZ" int print_column_index(char *column_string, int column_index) { bzero(column_string, sizeof(column_string)); column_string[0] = 'A' + column_index / strlen(ALPHABET) / strlen(ALPHABET) % strlen(ALPHABET) - 1; column_string[1] = 'A' + column_index / strlen(ALPHABET) % strlen(ALPHABET) - 1; column_string[2] = 'A' + column_index % strlen(ALPHABET) - 1; } int main(int argc, const char *argv[]) { char column_index[3 + 1]; print_column_index(column_index, 16384); printf("16384 -> %s\n", column_index); return 0; }