/*
* 输入两个空格退出程序
*/
#include <windows.h>
#include <stdio.h>
void main()
{
int a[4][4];
int i, j, pos;
char para[50];
char temp[5];
for( i = 0; i < 4; i++ )
for( j = 0; j < 4; j++ )
a[i][j] = 0;
for( i = 0; i < 4; i++ )
{
ZeroMemory( para, 50 );
ZeroMemory( temp, 5 );
pos = 0;
j = 0;
gets( para );
if( para[0] == 0 )
break;
for( int num = 0; para[num] != 0; num++ )
{
if( para[num] > 47 && para[num] < 58)
{
continue;
}
else
{
para[num] = 0;
if( para[num+1] > 47 && para[num+1] < 58 )
{
strcpy( temp, ¶[pos] );
pos = num + 1;
a[i][j] = atoi(temp);
j++;
}
continue;
}
}
strcpy( temp, ¶[pos] );
a[i][j] = atoi(temp);
}
printf("\nThe Array is:\n");
for( i = 0; i < 4; i++ )
{
for( j = 0; j < 4; j++ )
{
printf( "%d ", a[i][j] );
}
printf( "\n" );
}
}
posted on 2007-03-04 11:51
周Q 阅读(1045)
评论(0) 编辑 收藏 引用