#include #include /* ///// ______________ d|o-o|b | | \O/ .:______________| ` */ #define MAN_LINE_1 "\ //// _______________________________________________________________" #define MAN_LINE_2_START "\ d|o-o|b |" #define MAN_LINE_3_START "\ \\O/ .:" #define MAN_LINE_4_START "\ ` |" #define MAN_LINE_BLANK "\ |" int main(int argc, char **argv){ char c = '\0'; int column = 0; int line = 0; int i; //Grab until the new line character while(c != '\n'){ //Only upercase if it's the first character if(c == '\0'){ c = getchar(); //and it's between a and z if(c >= 'a' && c <= 'z'){ //223 = b 1101 1111 c = c & 223;//Set the 32 bit to 0 } }else{ c = getchar(); } if(c == '\n') break; if(line == 0){ printf("%s\n",MAN_LINE_1); line++; column = 0; } if(line == 1 && column == 0){ printf("%s",MAN_LINE_2_START); column = strlen(MAN_LINE_2_START); } putchar(c); column++; if(line == 1 && column == 78){ printf("|\n"); printf("%s",MAN_LINE_3_START); line++; column = strlen(MAN_LINE_3_START); } if(line == 2 && column == 78){ printf("|\n"); printf("%s",MAN_LINE_4_START); line++; column = strlen(MAN_LINE_4_START); } if(line >= 3 && column == 78){ printf("|\n"); printf("%s",MAN_LINE_BLANK); line++; column = strlen(MAN_LINE_BLANK); } } //Don't break, fall through to finish whatever lines we havn't done yet switch(line){ case 1: i = 78 - column; while(i-- > 0) printf(" "); printf("|\n"); printf("%s",MAN_LINE_3_START); column = strlen(MAN_LINE_3_START); case 2: i = 78 - column; while(i-- > 0) printf(" "); printf("|\n"); printf("%s",MAN_LINE_4_START); column = strlen(MAN_LINE_4_START); default: //Finish off the line i = 78 - column; while(i-- > 0) printf(" "); printf("|\n"); //Then print our bottom border printf("%s",MAN_LINE_BLANK); column = strlen(MAN_LINE_BLANK); i = 78 - column; while(i-- > 0) printf("_"); printf("|\n"); break; } return 0; }