Question

In Visual Studio 2017 Populate a two-dimensional array with the following prices in this table order:...

In Visual Studio 2017

Populate a two-dimensional array with the following prices in this table order: 32.34 22.33 68.30 36.99 43.94 63.67 55.89 67.44 13.77 87.13 54.99 87.78 18.42 21.60 45.98 66.03 41.38 74.48 24.21 67.10 61.23 Write a method/function which uses loops and is called from main() that increases the prices by 6.5% and stores the new price in the same array. All changes to the array must be made inside the method/function. Please display the original array in table form as well as the new array with the 6.5% price increase.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>
using namespace std;

void change(double a[7][3])
{
int i,j,k;
   for(i=0;i<7;i++)
   {
   for(j=0;j<3;j++)
   {
   //cout<<a[i][j]<<" ";
   a[i][j]=1.065*a[i][j];
   }
   //cout<<endl;
   }
  
   for(i=0;i<7;i++)
   {
   for(j=0;j<3;j++)
   {
   cout<<a[i][j]<<" ";
   }
   cout<<endl;
   }
   return ;
  
}

int main() {
   double a[7][3]={32.34, 22.33, 68.30 ,36.99 ,43.94 ,63.67 ,55.89, 67.44, 13.77 ,87.13 ,54.99, 87.78, 18.42, 21.60, 45.98, 66.03 ,41.38, 74.48 ,24.21, 67.10 ,61.23};
   int i,j,k;
   cout<<"The original prices are :\n";
   for(i=0;i<7;i++)
   {
   for(j=0;j<3;j++)
   {
   cout<<a[i][j]<<" ";
   }
   cout<<endl;
   }
   cout<<endl;
   cout<<"The prices after 6.5% increase :\n";
   change(a);
   return 0;
}

Add a comment
Know the answer?
Add Answer to:
In Visual Studio 2017 Populate a two-dimensional array with the following prices in this table order:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT