Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Price.cpp // This program will read in prices and store them into a two-dimensional array. // It will print those prices in a table form.

image text in transcribed
Price.cpp
// This program will read in prices and store them into a two-dimensional array.
// It will print those prices in a table form.
#include
#include
using namespace std;
const int MAXROWS = 10;
const int MAXCOLS = 10;
typedef float PriceType[MAXROWS][MAXCOLS]; // creates a new data type
// of a 2D array of floats
void getPrices(PriceType, int&, int&); // gets the prices into the array
void printPrices(PriceType, int, int); // prints data as a table
int main()
{
int rowsUsed; // holds the number of rows used
int colsUsed; // holds the number of columns used
PriceType priceTable; // a 2D array holding the prices
getPrices(priceTable, rowsUsed, colsUsed); // calls getPrices to fill the array
printPrices(priceTable, rowsUsed, colsUsed); // calls printPrices to display array
return 0;
}
//*******************************************************************************
// getPrices
//
// task: This procedure asks the user to input the number of rows and
// columns. It then asks the user to input (rows * columns) number of
// prices. The data is placed in the array.
// data in: none
// data out: an array filled with numbers and the number of rows
// and columns used.
//
//*******************************************************************************
void getPrices(PriceType table, int& numOfRows, int& numOfCols)
{
cout
cin >> numOfRows;
cout
cin >> numOfCols;
for (int row = 0; row
{
for (int col = 0; col
{
// Fill in the code to read and store the next value in the array
}
}
}
//***************************************************************************
// printPrices
//
// task: This procedure prints the table of prices
// data in: an array of floating point numbers and the number of rows
// and columns used.
// data out: none
//
//****************************************************************************
void printPrices(PriceType table, int numOfRows, int numOfCols)
{
cout
for (int row = 0; row
{
for (int col = 0; col
{
// Fill in the code to print the table
}
}
}
11:49 v LAB 7.3.docx Look at the following wble containing prics of certain 12.78 23.78 1267 1671 Retrieve pri Exercise 2: Why does pePices have the params Exercise The following code is a funon hat the array. Afier stodying i very canefullyplace the program and have the program print ou the highel 3000200 Open With Print

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago