版主
主题
回帖0
积分10609
阅读权限200
注册时间2008-11-22
最后登录1970-1-1
在线时间 小时
|
楼主 |
发表于 2018-3-24 10:55
|
显示全部楼层
main.c
4 r4 W7 Z6 h! n8 t1 p////////////////////////////////////////////////////////////9 U9 F) C) W; k1 v+ U( H
#include "shape.h" * h; |4 h# k0 r( l1 M
#include <stdio.h> /* for printf() */
' G6 P% d& o7 ~ _. W: }# hint main() {/ q) T8 c; e+ I/ i0 \
Shape s1, s2; , _# P" B/ h) U" `
Shape_ctor(&s1, 0, 1);
% z, C2 H+ @; M% ^ QShape_ctor(&s2, -1, 2);" o! E% n6 u- ]) L
printf("Shape s1(x=%d,y=%d)\n", s1.x, s1.y);) P' C' y- F! H/ |8 d3 `
printf("Shape s2(x=%d,y=%d)\n", s2.x, s2.y);
% {' G" [+ l3 J. V4 cShape_moveBy(&s1, 2, -4);
7 h4 h4 c+ P7 l: v* ^8 k# t. x, F* q1 \Shape_moveBy(&s2, 1, -2);
7 a/ }% Y: M$ G; lprintf("Shape s1(x=%d,y=%d)\n", s1.x, s1.y);, H: @0 F+ T5 a! H
printf("Shape s2(x=%d,y=%d)\n", s2.x, s2.y);# Y& I/ ~8 ^& K- W! b
return 0;
1 a8 _2 Q1 ~; E8 k, w}. l* b- S# J. [$ Y& @, d$ ~7 K
) Q7 o4 x$ { E. j9 r6 p |
|