帮忙瘦瘦身
这是个打任意空心长方形的程序,要求尽量简化,但是不能使用超出下边语句范围的语句,不能goto,只能whil/if#include<stdio.h>
#include<windows.h>
int main()
{
int x=0,y=0,i=1,j=1,k;
printf("input chang (-1 to end):");
scanf("%d",&x);
while(x!=-1){
printf("input kuan :");
scanf("%d",&y);
while(i<=x){
printf("*");
++i;}
printf("\n");
while(j<=y-2){
printf("*");
k=x-2;
while(k!=0){
printf(" ");
k--;}
printf("*");
k=x-2;
++j;
printf("\n");}
i=1;j=1;
while(i<=x){
printf("*");
++i;}
printf("\n");
i=1;j=1;
printf("input chang (-1 to end):");
scanf("%d",&x);
}
system("pause");
return 0;}