-1
我想显示一个数组排列,输入行数和列数,并在输入间隔插入一个符号。我有这个到目前为止,但我的输出一次只显示1行直到输入被按下以选择多少行。我甚至还没有开始插入间隔符号。任何帮助,将不胜感激。显示一个数组排列
#include <iostream>
using namespace std;
int rows = 0, columns = 0,intervals= 0;
void Display(int rows = 0, int columns = 0, int intervals = 0);
int main()
{
cout << "Enter number of rows: ";
cin >> rows;
cout << "Enter the number of columns: ";
cin >> columns;
cout << "Enter the number of the question mark interval: ";
cin >> intervals;
cout << "\n";
cout << "How many rows do you want? " << rows << "\n";
cout << "How many columns do you want? " << columns << "\n";
cout << "How far between question marks? " << intervals << "\n";
Display(rows, columns, intervals);
return(0);
system("pause");
}
void Display(int rows, int columns, int intervals)
{
for (int y = 1; y <= rows; y++)
{
for (int x = 1; x <= columns; x++) {
cout << intervals;
}
cout << endl;
system("pause");
}
}
是不是因为你有'系统(“暂停”);'每行您完成打印后? – TriHard8 2015-04-05 03:42:30