c++ - Show an array arrangement -
c++ - Show an array arrangement -
i wanting show array arrangement input # of rows , # of columns , insert symbol @ input interval.i have far output shows 1 row @ time until come in pressed how ever many rows selected. haven't started on interval symbol insertion yet. help on appreciated.
#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 number of columns: "; cin >> columns; cout << "enter number of question mark interval: "; cin >> intervals; cout << "\n"; cout << "how many rows want? " << rows << "\n"; cout << "how many columns 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) { (int y = 1; y <= rows; y++) { (int x = 1; x <= columns; x++) { cout << intervals; } cout << endl; system("pause"); } }
use system("pause")
outside loop -
void display(int rows, int columns, int intervals) { (int y = 1; y <= rows; y++) { (int x = 1; x <= columns; x++) { cout << intervals; } cout << endl; } system("pause"); }
c++
Comments
Post a Comment