蛮难的
看看
受益匪浅,小甲鱼好补身体啊
不错
看看
huifu
.....................有朦胧的灵感
学习学习
#include<stdio.h>
#include<stdlib.h>
typedef struct QNode
{
char data;
struct QNode *next;
}QNode,*Queue;
typedef struct
{
Queue front,rear;
}LinkQueue;
void initQueue( LinkQueue *q )
{
q->front = q->rear = ( Queue )malloc( sizeof( QNode ) );
if( !q->front )
exit(0);
q->front->next = NULL;
}
void insertQueue( LinkQueue *q, char e )
{
Queue p;
p = ( Queue )malloc( sizeof( QNode ) );
if( p == NULL )
exit(0);
p->data = e;
p->next = NULL;
q->rear->next = p;
q->rear = p;
}
void DeleteQueue( LinkQueue *q, char *e )
{
Queue p;
if( q->front == q->rear )
return;
p = q->front->next;
*e = p->data;
q->front->next = p->next;
if( q->rear == p )
q->rear = q->front;
free(p);
}
int main()
{
char e,E,F;
int i = 0,j = 0 , h = 0 ,k;
LinkQueue q;
while(1)
{
initQueue( &q );
scanf("%c",&F);
while( F != '#' )
{
insertQueue( &q , F );
scanf("%c",&F);
i++;
}
DeleteQueue( &q, &e);
while( i != 1 )
{
DeleteQueue( &q, &E);
if( e == E )
insertQueue( &q , '+' );
else
insertQueue( &q , '-' );
printf("%c ",e);
j++;
e = E;
if( i == j )
{
printf("\n");
h++;//用来记录需打印每一行的空格数
i = i - 1;
for( k = 0; k < h ; k++ )
printf(" ");
j = 0;
}
}
printf("%c",e);
}
return 0;
}
看看
看看
{:5_91:}
{:5_90:}
666
答案
很给力啊!
学习
来看答案的
{:5_108:}
谢谢小甲鱼老师