表をかく
:
/*
:
Windows , 。
:
┌──┬──┐
│ │ │
├──┼──┤
│ │ │
└──┴──┘
, :
= ┌
= ┬
= ┐
= ├
= ┼
= ┤
= └
= ┴
= ┘
= │
= ─
, 、 。
:
3 2
:
┌──┬──┐
│ │ │
├──┼──┤
│ │ │
├──┼──┤
│ │ │
└──┴──┘
:
2 3
:
┌──┬──┬──┐
│ │ │ │
├──┼──┼──┤
│ │ │ │
└──┴──┴──┘
, ANSI C++ , 、Win32API、 、 API。
STL , MFC ATL ANSI c++ 。 , CString ( MFC )。
*/
#include
using namespace std;
int main()
{
cout<>low;
int lie; //
cin>>lie;
int i,j,k;
int zhong; // ,
for(i=1;i<=low+1;i++)
{
if(i==1) //
{ cout<
方法2:
// #include
#include using namespace std; int main() { int n, m; while (cin >> n >> m) { for(int i = 1; i <= n * 2 + 1; i++) { if(i == 1) { cout << "┌"; for(int j = 1; j <= m - 1; j++) { cout << "─┬"; } cout << "─┐" << endl; } else if(i == n * 2 + 1) { cout << "└"; for(int j = 1; j <= m - 1; j++) { cout << "─┴"; } cout << "─┘" << endl; } else if (i % 2 == 0) { for(int j = 1; j <= m; j++) { cout << "│" << " "; } cout << "│" << endl; } else { cout << "├"; for(int j = 1; j <= m - 1; j++) { cout << "─┼"; } cout << "─┤" << endl; } } } return 0; }
クリックしてリンクを開く