69,373
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
int main()
{
int i;
unsigned int j;
char s[5];
fscanf(stdin,"%d %x %5[a-z] %*s %f",&i,&j,s,s);
printf("%d %d %s",i,j,s);
return 0;
}
#include <stdio.h>
int main()
{
char *str1 = "abcdefghijklmnopq";
double d = 3.1415926535;
int i, j=1;
for( i = 5; i < 10; i++ )
{
printf( "%.*s\n", i, str1 );
}
printf( "********************\n");
for( i = 1; i < 10; i+=2)
{
printf( "%*.*lf\n", i, j++, d );
}
return 0;
}
Ljia @ ~/cfiles/tests $ cat test.c
#include <stdio.h>
int main()
{
int i;
unsigned int j;
char s[5];
float f;
fscanf(stdin,"%d %x %5[a-z] %*s %f",&i,&j,s,&f);
printf("%d %d %s\n",i,j,s);
printf("%d\n", j);
fscanf(stdin, "%x", &j);
printf("%d\n", j);
return 0;
}
Ljia @ ~/cfiles/tests $ ./a.out
10 0x1b abcdefg 3.23
10 0 abcde
0
0x1b
27
Ljia @ ~/cfiles/tests $