请注意恶心的输出格式
查看原帖
请注意恶心的输出格式
409860
yu1102楼主2023/7/22 18:58

输出方案时:两个空行

保险起见,使用setw(4)

		cout << endl << endl;
		for (int i = 1; i <= 7; i++)
		{
			for (int j = 1; j <= 8; j++)
				cout << setw(4) << tag[i][j];
			cout << endl;
		}

每两组数据之间五个空行,末尾不能有多余空行:

		if (kase++) printf("\n\n\n\n\n");

这个情况是一个空行:

printf("\nMaps resulting from layout #%d are:\n", kase);

其余所有输出都是两个空行:

		printf("Layout #%d:\n\n\n", kase);
		for (int i = 1; i <= 7; i++)
		{
			for (int j = 1; j <= 8; j++)
				cout << setw(4) << a[i][j];
			cout << endl;
		}

		printf("\nMaps resulting from layout #%d are:\n", kase);
		
		//......
		
		printf("\n\nThere are %d solution(s) for layout #%d.\n", ans, kase);
2023/7/22 18:58
加载中...