void tree_draw_page( ScrollPos &scroll ) { VString str = " "; str_mul( str, con_max_x() ); str = " SiZE DiRECTORY" + str; str_sleft( str, con_max_x()-16 ); con_out(1,3, str, cHEADER ); int z = 0; for(z = 0; z < scroll.pagesize(); z++) { if (scroll.page() + z <= scroll.max()) { tree_draw_item( scroll.page(), z ); } else { con_xy( 1, 3+1+z ); con_puts( "~", cCYAN ); con_ce( cCYAN ); } } }
int main(void) { char buffer[7] = {0}; int count; int point_num = 0; char num_ans[126]; struct node *phead = NULL; while (scanf("%s %d",buffer,&count) == 2){ buffer[6] = '\0'; point_num = str_to_num(buffer); struct node *ptemp = (struct node *)malloc(sizeof(struct node)); strncpy(ptemp->num_str,buffer,strlen(buffer) + 1); ptemp->num = point_num * count; while (count > 1){ str_mul(buffer,ptemp->num_str,num_ans); count--; } ptemp->next = phead; phead = ptemp; } if (phead->next != NULL) phead = sll_reverse(phead); struct node *p_index = phead; int flag; int sum_bit = 0; while (phead != NULL){ sum_bit = strlen(phead->num_str); flag = 0; for (count = 125; count > 0; count--){ if ((phead->num_str[count] - 48) > 0){ if (count < sum_bit - phead->num){ phead->num_str[sum_bit - phead->num] = '\0'; break; } phead->num_str[count+1] = '\0'; break; } } for (count = 0; phead->num_str[count] != '\0'; count++){ if ((phead->num_str[count] > 48) || (count == (sum_bit - phead->num))){ flag = 1; } if (count == sum_bit - phead->num) putchar('.'); if (flag == 1) putchar(phead->num_str[count]); } putchar('\n'); phead = phead->next; } phead = p_index; while (phead != NULL){ p_index = phead; phead = phead->next; p_index->next = NULL; free(p_index); } return 0; }