
11-12-2007, 17:03
|
|
|
|
חבר מתאריך: 02.12.07
הודעות: 76
|
|
קוד:
# include <stdio.h>
# include <string.h>
void display ()
{
int digit,dig7Seg,a,b,c,d,e,f,g;
if (digit==0)
{ a=b=c=d=e=f=1;
g=0;
dig7Seg=01111110;
}
else if (digit==1)
{ a=d=e=f=g=0;
b=c=1;
dig7Seg=00110000;
}
else if (digit==2)
{ a=b=g=e=d=1;
c=f=0;
dig7Seg=01101101;
}
else if (digit==3)
{ a=b=c=d=g=1;
e=f=0;
dig7Seg=01111001;
}
else if (digit==4)
{ b=c=f=g=1;
a=d=e=0;
dig7Seg=00110011;
}
else if (digit==5)
{ a=f=g=c=d=1;
b=e=0;
dig7Seg=01011011;
}
else if (digit==6)
{ a=f=e=d=c=g=1;
b=0;
dig7Seg=01011111;
}
else if (digit==7)
{ a=b=c=1;
d=e=f=g=0;
dig7Seg=01110000;
}
else if (digit==8)
{ a=b=c=d=e=f=g=1;
dig7Seg=01111111;
}
else if (digit==9)
{ a=b=c=d=f=g=1;
e=0;
dig7Seg=01111011;
}
if (a==1)
{ printf(" __\n");
a=0;
}
if (b==1)
{ printf(" |\n\n");
b=0;
}
if (c==1)
{ printf(" |\n");
c=0;
}
if (d==1)
{ printf(" __\");
d=0;
}
if (e==1)
{ printf("|\n");
e=0;
}
if (f==1)
{ printf("|\n\n");
f=0;
}
if (g==1)
{ printf("__\n");
g=0;
}
return 0;
}
int main ()
{
char str[17];
int i=8,digit;
gets(str);
if (((((((((str[0]=='d')||(str[0]=='D'))&&((str[1]=='i')||(str[1]=='I'))&&((str[2]=='s')||(str[2]=='S'))&&((str[3]=='p')||(str[3]=='P'))&&
((str[4]=='l')||str[4]=='L'))&&((str[5]=='a')||(str[5]=='A'))&&((str[6]=='y')||(str[6]=='Y'))))))))
{ if (str[7]==' ')
{ while (i!=16)
{ digit=str[i]-48;
display(digit);
i++;
}
}
}
return 0;
}
|