如何打印上线帮助 [英] how to print an overline pls help
本文介绍了如何打印上线帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#include<iostream>
#include<iomanip>
using namespace std;
const int iRow = 9;
const int iColumn =9;
void PrintArray(int iNum[][iColumn], int iR, int iC){
for(int i=0;i<iR;i++){
cout<< "\n";
cout<<" ___ ___ ___ ___ ___ ___ ___ ___ ___ ";
cout<< "\n";
for(int j=0; j<iC; j++){
cout<< "[ "<<iNum[i][j]<<" ]";
}
cout<<" ";
cout<< "\n";
}
}
int main(){
int iSud[iRow][iColumn] = { { 4, 5, 2, 3, 9, 1, 8, 7, 6 },
{ 3, 1, 8, 6, 7, 5, 2, 9, 4 },
{ 6, 7, 9, 4, 2, 8, 3, 1, 5 },
{ 8, 3, 1, 5, 6, 4, 7, 2, 9 },
{ 2, 4, 5, 9, 8, 7, 1, 6, 3 },
{ 9, 6, 7, 2, 1, 3, 5, 4, 8 },
{ 7, 9, 6, 8, 5, 2, 4, 3, 1 },
{ 1, 8, 3, 7, 4, 9, 6, 5, 2 },
{ 5, 2, 4, 1, 3, 6, 9, 8, 7 }
};
PrintArray(iSud,iRow,iColumn);
}
如果你运行代码,它几乎看起来像数字在一个盒子里,除了有一个开口底部。
如何打印上划线符号/字符。我需要它来完成打印输出
谢谢
if you run the code it will almost look like the numbers are in a box except there is an opening at the bottom.
how can I print an overline symbol/character. I need it to complete the printed output
thanks
推荐答案
简单解决方案:在整个循环之后插入您的打印代码。
复杂的解决方案:再循环一次打印代码。
Easy solution: insert your print code AFTER the whole loop.
Complex solution: loop one more time for print code.
void PrintArray(int iNum[][iColumn], int iR, int iC){
for(int i=0;i<=iR;i++){
cout<< "\n";
cout<<" ___ ___ ___ ___ ___ ___ ___ ___ ___ ";
cout<< "\n";
//exit loop after close print
if( i == (iR-1) ) break;
for(int j=0; j<ic;> cout<< "[ "<<iNum[i][j]<<" ]";
}
cout<<" ";
cout<< "\n";
}
}
上划线字符的UNICODE
字符为 U + 203E [ ^ ]。
以下丑陋的代码在我的系统上起作用(Linux
,g ++ 4.7.3
)。
TheUNICODE
character for the overline character is U+203E[^].
The following ugly code does the trick on my system (Linux
withg++ 4.7.3
).
void PrintArray(int iNum[][iColumn], int iR, int iC){
for(int i=0;i<iR;i++){
cout<< "\n";
cout<<" ___ ___ ___ ___ ___ ___ ___ ___ ___ ";
cout<< "\n";
for(int j=0; j<iC; j++){
cout<< "[ "<<iNum[i][j]<<" ]";
}
cout<<" ";
cout<< "\n";
for (int i=0; i<9; ++i)
cout << " \u203E\u203E\u203E ";
cout << endl;
}
}
这篇关于如何打印上线帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文