#include
#include
#include
using std::cout;
using std::endl;
using std::string;
void show_data(const int data[], int count = 1,
const string& title = "Data Values", int width = 10, int perLine =5);
int main() {
int data[] = {1, 2, 3, 4};
int dataItem = 99;
show_data (&dataItem);
dataItem = 13;
show_data(&dataItem, 1, "Unlucky for some!");
show_data(data, sizeof data/sizeof data[0]);
show_data(data, sizeof data/sizeof data[0], "title 1");
show_data(data, sizeof data/sizeof data[0], "title 2", 14);
show_data(data, sizeof data/sizeof data[0], "title 3", 14, 4);
return 0;
}
void show_data (const int data[], int count, const string& title,int width, int perLine) {
cout << endl << title;
cout << endl << perLine;
cout << endl << width << data[2];
cout << endl;
}
Data Values
5
102
Unlucky for some!
5
102
Data Values
5
103
title 1
5
103
title 2
5
143
title 3
4
143