520到了,作为程序员的我,必须给女朋友送上一个520
#include
#include
#include
#include
using namespace std;
#define IS_MAC true
const string Name = "霜";
int Word[10][7] = {
{0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00},
{0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00},
{0xc0, 0x00, 0x03, 0x00, 0xc3, 0x00, 0x00},
{0xc0, 0x00, 0x03, 0x00, 0xc3, 0x00, 0x00},
{0xff, 0x00, 0xff, 0x00, 0xc3, 0x00, 0x00},
{0xff, 0x00, 0xff, 0x00, 0xc3, 0x00, 0x00},
{0x03, 0x00, 0xc0, 0x00, 0xc3, 0x00, 0x00},
{0x03, 0x00, 0xc0, 0x00, 0xc3, 0x00, 0x00},
{0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00},
{0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00}
};
void printHex(int value) {
for (int i = 7; i >= 0; i--) {
cout << (((value >> i) & 0x01) ? Name : " ");
}
}
void leftMoveRow(int row) {
string binSerial = "";
for (int i = 0; i < 7; i++) {
for (int j = 7; j >= 0; j--) {
binSerial += ((Word[row][i] >> j) & 0x01) ? "1" : "0";
}
}
binSerial += binSerial[0];
binSerial.erase(0, 1);
int index = 0;
int temp = 0;
for (int i = 0; i < binSerial.length(); i++) {
if (i && i % 8 == 0) {
Word[row][index] = (temp & 0xff);
index++;
temp = 0;
}
if (binSerial[i] == '1') {
temp += (1 << (7 - (i % 8)));
}
}
Word[row][index] = (temp & 0xff);
binSerial = "";
for (int i = 0; i < 7; i++) {
for (int j = 7; j >= 0; j--) {
binSerial += ((Word[row][i] >> j) & 0x01) ? "1" : "0";
}
}
}
void leftMove() {
for (int i = 0; i < 10; i++) {
leftMoveRow(i);
}
}
void printWord() {
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 7; j++) {
printHex(Word[i][j]);
}
cout << endl;
}
}
int main() {
while (true) {
system(IS_MAC ? "clear" : "cls");
printWord();
leftMove();
cout << "\nBy:Js君" << endl;
usleep(50000);
}
return 0;
}