1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| #include <iostream> #include <string> #include <ctime> using namespace std; string num[5][11] = {"****", " *", "****", "****", "* *", "****", "****", "****", "****", "****", " ", "* *", " *", " *", " *", "* *", "* ", "* ", " *", "* *", "* *", " * ", "* *", " *", "****", "****", "****", "****", "****", " *", "****", "****", " ", "* *", " *", "* ", " *", " *", " *", "* *", " *", "* *", " *", " * ", "****", " *", "****", "****", " *", "****", "****", " *", "****", "****", " "};
int main() { int i,j;
time_t t= time(0); tm *curtime = localtime(&t);
int hour = curtime->tm_hour; int min = curtime->tm_min; int sec = curtime->tm_sec; cout << hour << ":" << min << ":" << sec << endl; cout << endl;
int timeArray[8]; timeArray[0] = hour / 10; timeArray[1] = hour % 10; timeArray[2] = 10; timeArray[3] = min / 10; timeArray[4] = min % 10; timeArray[5] = 10; timeArray[6] = sec / 10; timeArray[7] = sec % 10;
for(i = 0; i < 5; i ) { for(j = 0; j < 8; j ) { cout << num[i][timeArray[j]] << " "; } cout << endl; } return 0; }
|