The digits showed by the digital clock are as follows:
_ _ _ _ _ _ _ _
| _| _||_||_ |_ ||_||_|| |
||_ _| | _||_| ||_| _||_| 应用三维字符数组: #include <stdio.h>
#include <string.h>
#include <iostream>
using namespace std;
char a[3][10][4]={{" _ "," "," _ "," _ "," "," _ "," _ "," _ "," _ "," _ "},
{"| |"," |"," _|"," _|","|_|","|_ ","|_ "," |","|_|","|_|"},
{"|_|"," |","|_ "," _|"," |"," _|","|_|"," |","|_|"," _|"}
};
int n[5];
int main()
{
while(~scanf("%d%d%d%d",&n[0],&n[1],&n[2],&n[3]))
{
for(int i=0;i<3;i++)
{
for(int j=0;j<4;j++)
printf("%s",a[i][n[j]]);
puts("");
}
}
return 0;
}
<br /><span id="_xhe_temp" width="0" height="0"><br /></span>
|