qfedu-c-level/day12/homework/h1.c

14 lines
421 B
C
Raw Normal View History

2023-07-22 10:37:20 +08:00
// 给定一张图片的规格信息,请提取出图片的格式、宽和高。 char *s = "base64;image/png:320,480";
// 输出结果: image / png 320 480
#include <stdio.h>
#include <string.h>
int main()
{
char *s = "base64;image/png:320,480";
char *format;
int width, height;
sscanf(s, "%*[^;];%[^:]:%d,%d", format, &width, &height);
printf("%s %d %d\n", format, width, height);
return 0;
}