วันเสาร์ที่ 12 พฤศจิกายน พ.ศ. 2559

C++ LED NUMBER


#include <iostream>
#include <math.h>
#include <iomanip>
#include <time.h>
#include <thread>
#include <windows.h>
using namespace std;

int main(int argc, char** args)
{
char x[10][5][5] = { {
"xxxx",
"x  x",
"x  x",
"x  x",
"xxxx",
},

{
"   x",
"   x",
"   x",
"   x",
"   x",
},

{
 "xxxx",
 "   x",
 "xxxx",
 "x   ",
 "xxxx",
 },
 {
  "xxxx",
  "   x",
  "xxxx",
  "   x",
  "xxxx",
  },
  {
"x  x",
"x  x",
"xxxx",
"   x",
"   x",
},
{
"xxxx",
"x   ",
"xxxx",
"   x",
"xxxx",
},
{
"x   ",
"x   ",
"xxxx",
"x  x",
"xxxx",
},
{
"xxxx",
"   x",
"   x",
"   x",
"   x",
},
{
"xxxx",
"x  x",
"xxxx",
"x  x",
"xxxx",
},
{
"xxxx",
"x  x",
"xxxx",
"   x",
"   x",
} };
    int num, temp[12], i, count;
char c;
srand(time(NULL));
for (int k = 1; k < 1000; k++)
{
if (k == 999)
k = 1;
num = k;
count = 0;
i = 0;
while (num > 0)
{
temp[i] = num % 10;
num = num / 10;
i++;
}
count = i;
cout << endl;
for (int k = 0; k < 5; k++)
{
for (i = count - 1; i >= 0; i--)
{
cout << x[temp[i]][k] << "\t";
}
Sleep(10);
cout << endl;
}
cout << endl;
}
return 0;
}


ไม่มีความคิดเห็น:

แสดงความคิดเห็น