回复:(stupid_boy)用了672K的内存.....鄙人用两种方...
你用了16K内存?不敢相信啊,贴上来看看
[UserName=stupid_boy]
程序代码:
#include <stdio.h>
#define PC(x) putchar(x)
#define PCD(x,y) putchar(digits[ch-'0'][x]?y:' ')
int digits[10][7]={1,0,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,0,1,1,0,1,1,1,0,1,0,1,0,1,0,1,
1,0,1,1,1,1,1,0,0,1,1,1,1,1,0,1,1,1,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,};
void out(int s,char ch,int k)
{
switch(k){
case 0:
case 2:
case 4:
PC(' ');
for(int i=0;i<s;i++){
PCD(k/2,'-');
}
PC(' ');
break;
case 1:
case 3:
PCD(k+2,'|');
for(int i=0;i<s;i++){
PC(' ');
}
PCD(k+3,'|');
break;
}
}
void out(int s,char* str,int suit)
{
out(s,*str,suit);
for(char *p=str+1;*p;p++){
PC(' ');
out(s,*p,suit);
}
}
int main()
{
char buf[100];
int s;
while(scanf(\"%d %s\",&s,buf)!=EOF && s){
out(s,buf,0);
PC('\n');
for(int i=0;i<s;i++){
out(s,buf,1);
PC('\n');
}
out(s,buf,2);
PC('\n');
for(int i=0;i<s;i++){
out(s,buf,3);
PC('\n');
}
out(s,buf,4);
PC('\n');
PC('\n');
}
}
[/UserName]