求助!!!盯了半天,不知道哪错了。。。代码一坨
查看原帖
求助!!!盯了半天,不知道哪错了。。。代码一坨
1086957
SZRKDSZ楼主2023/11/14 16:56
#include<iostream>
using namespace std;
int put[5][400] = {0};
int n = 0, point[5] = {0};
void pd(int start_y,int a1,int a2,int a3,int a4,int a5) {
	put[0][start_y] = { a1 };
	put[1][start_y] = { a2 };
	put[2][start_y] = { a3 };
	put[3][start_y] = { a4 };
	put[4][start_y] = { a5 };
}
void num(int start_y,int nums) {
	switch (nums) {
	case 0:for (int i = 0; i < 5; i++) { put[i][start_y] = { 1 }; }
		  put[0][start_y + 1] = { 1 }; put[4][start_y + 1] = { 1 };
		  for (int i = 0; i < 5; i++) { put[i][start_y + 2] = { 1 }; }
		  break;
	case 1:
		  for (int i = 0; i < 5; i++) { put[i][start_y + 2] = { 1 }; }break;
	case 2:
		pd(start_y, 1, 0, 1, 1, 1);
		pd(start_y+1, 1, 0, 1, 0, 1);
		pd(start_y+2, 1, 1, 1, 0, 1); break;
	case 3:
		pd(start_y, 1, 0, 1, 0, 1);
		pd(start_y + 1, 1, 0, 1, 0, 1);
		pd(start_y + 2, 1, 1, 1, 1, 1); break;
	case 4:
		pd(start_y, 1, 1, 1, 0, 0);
		pd(start_y + 1, 0, 0, 1, 0, 0);
		pd(start_y + 2, 1, 1, 1, 1, 1); break;
	case 5:
		pd(start_y, 1, 1, 1, 0, 1);
		pd(start_y + 1, 1, 0, 1, 0, 1);
		pd(start_y + 2, 1, 0, 1, 1, 1); break;
	case 6:
		pd(start_y, 1, 1, 1, 1, 1);
		pd(start_y + 1, 1, 0, 1, 0, 1);
		pd(start_y + 2, 1, 0, 1, 1, 1); break;
	case 7:
		pd(start_y,     1, 0, 0, 0, 0);
		pd(start_y + 1, 1, 0, 0, 0, 0);
		pd(start_y + 2, 1, 1, 1, 1, 1); break;
	case 8:
		pd(start_y,     1, 1, 1, 1, 1);
		pd(start_y + 1, 1, 0, 1, 0, 1);
		pd(start_y + 2, 1, 1, 1, 1, 1); break;
	case 9:
		pd(start_y,     1, 1, 1, 0, 1);
		pd(start_y + 1, 1, 0, 1, 0, 1);
		pd(start_y + 2, 1, 1, 1, 1, 1); break;
	}
	
}
	


int main() {
	cin >> n;
	int nums,* p;
	p = new int[n];
	cin >> nums;
	for (int i = 0; i < n; i++) {
		p[n - 1 - i] = { nums % 10 };
		nums = nums / 10;
	}
	for (int i = 0; i < n; i++) {
		num(4*i,p[i]);
	}
	for (int a = 0; a < 5; a++) {
		for (int i = 0; i < (4 * n)-1; i++) {
			if (put[a][i] == 1) { cout << 'X'; }
			else { cout << '.'; }
		}
		cout << endl;
	}
}

2023/11/14 16:56
加载中...