[MS]excel labels

Excel labels its rows with letters. For example row 0 is labeled 'A', row 1 is labeled 'B', row 26 is labeled 'AA', and so on.

Design, and implement in C, an algorithm that will map any row number, such as 2842, into into its proper row designation. For instance row 2842, maps to the designation 'DEI'

Comments

  1. void rowmap(const int row)
    {
    if(row < 26)
    {
    printf("%c", 'A' + row);
    }
    else
    {
    div_t x = div(row, 26);

    rowmap(x.quot - 1);

    rowmap(x.rem);
    }

    }

    ReplyDelete

Post a Comment

Popular posts from this blog