Working with arrays

How would I make my array display the item, quantity, and price?

Here's what I have:

Main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include <string>
#include <iomanip>

using namespace std;
void displayItemsArray(string x[][3], int r, int c);
string getSearchItem();
int getSearchQuantity();
int calculatePrice(string Item, int Quantity);
void displayPurchase(string searchItem, int quantity, int price);
void displayPurchasesArray(string x[][3], int r, int c);

int main()
{
	string searchItem;
	int retrievedQuantity;
	int price;

	searchItem = getSearchItem();
	retrievedQuantity = getSearchQuantity();
	price = calculatePrice(searchItem, retrievedQuantity);
	cout << endl;
	displayPurchase(searchItem, retrievedQuantity, price);

	return 0;
}


Array
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <string>
#include <iostream>

using namespace std;
void displayPurchasesArray(string x[][3], int r, int c);

void displayPurchase(string searchItem, int quantity, int price)
{
	string purchases[3][3] = { {"Description", "Quantity", "Price"} };
	displayPurchasesArray(purchases, 3, 2);

	return;
}


I want to look like this:

Item1            Quantity1           Price1
...
...
Item4            Quantity4           Price4
Last edited on
Topic archived. No new replies allowed.