1 | #include <stdio.h> |
2 | #include <string.h> |
3 | |
4 | int |
5 | main(int argc, char *argv[]) |
6 | { |
7 | char buf[100]; |
8 | int point, x, y; |
9 | int status = 0; |
10 | |
11 | sscanf("0x10 10" , "%x %x" , &x, &y); |
12 | sprintf(buf, "%d %d" , x, y); |
13 | puts (s: buf); |
14 | status |= strcmp (buf, "16 16" ); |
15 | sscanf("P012349876" , "P%1d%4d%4d" , &point, &x, &y); |
16 | sprintf(buf, "%d %d %d" , point, x, y); |
17 | status |= strcmp (buf, "0 1234 9876" ); |
18 | puts (s: buf); |
19 | sscanf("P112349876" , "P%1d%4d%4d" , &point, &x, &y); |
20 | sprintf(buf, "%d %d %d" , point, x, y); |
21 | status |= strcmp (buf, "1 1234 9876" ); |
22 | puts (s: buf); |
23 | |
24 | puts (s: status ? "Test failed" : "Test passed" ); |
25 | |
26 | return status; |
27 | } |
28 | |