哈啊哈哈,在我的不屑努力之下,终于打印出来了#include<stdio.h>
#define IN 1
#define OUT 0
#define MAXSIZE 15
int MaxWordLen(int WORD_LEN[]);
int MaxWordLen(int WORD_LEN[])
{
int max=WORD_LEN[0];
for ( int i = 0; i < MAXSIZE; i++)
{
if (WORD_LEN[i]>=max)
{
max=WORD_LEN[i];
}
}
return max;
}
int main()
{
//统计各长度单词数量
int c,WORD_LEN[MAXSIZE],state,word_count,i;
state=OUT;
word_count=0;
for ( i = 0; i < MAXSIZE; i++)
{
WORD_LEN[i]=0;
}
while ((c=getchar())!=EOF)
{
if (c=='\n'||c==' '||c=='\t')
{
if (state==IN)
{
WORD_LEN[word_count-1]++;
word_count=0;
state=OUT;
}
}else
{
if (state==OUT||state==IN)
{
state=IN;
word_count++;
}
}
}
//打印垂直表
int max,j;
max=MaxWordLen(WORD_LEN);
for ( i = 0; i <= max; i++)
{
for ( j = 0;j < MAXSIZE; j++)
{
if (i>=(max-WORD_LEN[j]+1))
{
printf(" ** ");
}else
{
printf(" ");
}
}
printf("\n");
}
//printf(" 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15\n");
for ( i = 0; i <MAXSIZE; i++)
{
if (i<=8)
{
printf(" 0%d ",i+1);
}else
{
printf(" %d ",i+1);
}
}
return 0;
}
My dream is to be a sport player.I think sport player is a good job to make a lot of money ,and I can become very rich .When I become rich ,I will do lots of things ,for example,I will buy a big house with graden for my parents,I will travel around the world with my parents.I especially want to do the ting that is to help the persons in trouble and give a lot of money to the charities .There are my dreams ,I will work hard to make my dream come true
^Z
**
** **
** **
** **
** **
** **
** **
** **
** **
** **
** **
** ** **
** ** **
** ** **
** ** ** **
** ** ** ** **
** ** ** ** **
** ** ** ** ** **
** ** ** ** ** **
** ** ** ** ** **
** ** ** ** ** ** **
** ** ** ** ** ** **
** ** ** ** ** ** ** **
** ** ** ** ** ** ** ** ** **
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 |