Time | ||
| ||
description | ||
Digital clock use 4 digits to express time, each digit is described by 3*3 characters (including”|”,”_”and” “).now given the current time, please tell us how can it be expressed by the digital clock.
| ||
input | ||
There are several test cases.
Each case contains 4 integers in a line, separated by space.
Proceed to the end of file.
| ||
output | ||
For each test case, output the time expressed by the digital clock such as Sample Output.
| ||
sample_input | ||
1 2 5 6
2 3 4 2
| ||
sample_output | ||
_ _ _
| _||_ |_
||_ _||_|
_ _ _
_| _||_| _|
|_ _| ||_
| ||
hint | ||
The digits showed by the digital clock are as follows:
_ _ _ _ _ _ _ _
| _| _||_||_ |_ ||_||_|| |
||_ _| | _||_| ||_| _||_|
|
还有别的方法请多指教
代码:
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<math.h>
using namespace std;
int main()
{
int n,i,j,k,a[5];
while(~scanf("%d%d%d%d",&a[0],&a[1],&a[2],&a[3]))
{ for(i=0;i<4;i++)
{
switch(a[i])
{ case 2:
case 3:
case 5:
case 6:
case 7:
case 8:
case 9:
case 0:printf(" _ ");break;
case 4:
case 1:printf(" ");break;}}
printf("\n");
for(i=0;i<4;i++)
{
switch(a[i])
{ case 2:
case 3:printf(" _|");break;
case 5:
case 6:printf("|_ ");break;
case 7:printf(" |");break;
case 4:
case 8:
case 9:printf("|_|");break;
case 0:printf("| |");break;
case 1:printf(" |");break;}}
printf("\n");
for(i=0;i<4;i++)
{
switch(a[i])
{ case 2:printf("|_ ");break;
case 9:
case 3:
case 5:printf(" _|");break;
case 8:
case 6:printf("|_|");break;
case 7:printf(" |");break;
case 0:printf("|_|");break;
case 4:
case 1:printf(" |");break;}
}
printf("\n");
}
return 0;
}