วันพุธที่ 16 พฤศจิกายน พ.ศ. 2559

C++ LED Number



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;
cout << "Enter Number : ";
cin >> num;
count = 0;
i = 0;
while (num > 0)
{
temp[i] = num % 10;
num = num / 10;
i++;
}
count = i;
for (int k = 0; k < 5; k++)
{
for (i = count - 1; i >= 0; i--)
{
cout << x[temp[i]][k] << "\t";
}
cout << endl;
}


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

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