Can you fix the code? Its saying that fatal error no such file as iostream. It is in C++. #include #include using namespace std; const int QUARTERS = 4; //function prototype void printSalesData(double [][QUARTERS], int); int main() {     double salesData[3][QUARTERS] {0};     for(int div=0; div<3; ++div){         for(int qtr=0; qtr>salesData[div][qtr];         }     }          //call statement     printSalesData(salesData, 3);     return 0; } //function definition void printSalesData(double salesData[][QUARTERS], int numOfDiv) {     cout<<"Corpration Sales Report"<

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter10: Pointers
Section: Chapter Questions
Problem 5PP
icon
Related questions
Question

Can you fix the code? Its saying that fatal error no such file as iostream. It is in C++.

#include <iostream>
#include <iomanip>

using namespace std;
const int QUARTERS = 4;

//function prototype
void printSalesData(double [][QUARTERS], int);

int main()
{
    double salesData[3][QUARTERS] {0};
    for(int div=0; div<3; ++div){
        for(int qtr=0; qtr<QUARTERS; ++qtr){
            cin>>salesData[div][qtr];
        }
    }
    
    //call statement
    printSalesData(salesData, 3);

    return 0;
}


//function definition
void printSalesData(double salesData[][QUARTERS], int numOfDiv) {
    cout<<"Corpration Sales Report"<<endl;
    //print table header
    cout<<setw(10)<<"DIV"<<setw(10)<<"Q1"<<setw(10)<<"Q2"<<setw(10)<<"Q3"<<setw(10)<<"Q4"<<endl;
    for(int div=0; div<numOfDiv; ++div) {
        //print div number
        cout << setw(10) << div;
        for(int qtr=0; qtr<QUARTERS; ++qtr) {
        cout  << setw(10)<<salesData[div][qtr] ;
        }
        cout<<endl;
    }
}

The company has three divisions. The program uses a 2-D array of three rows and four columns. Each column
represents one quarter of the year. Each row represents the sales data of one division.
The program consists of a main function and another function for displaying a 2-D array passed in through arguments.
The program has defined a global constant to represent the number 4 as the four quarters of an year. Use this constant
identifier wherever the number 4 is required as the four quarters of a year.
Write the prototype for the function named printSalesData above the main function. The function receives a 2-D array
as the first argument and the number of divisions as the second argument. It returns void.
The main function has a 2-D array defined and initialized. It then reads the data from user to fill the array. You need to
supply the data when the program runs.
Complete the call statement that calls printSalesData function with the appropriate arguments to print the report.
Below the main function, write the definition of printSalseData.
Test The Program with the following input.
201.24
150.91
270.83
421.51
312.43
422.14
251.85
732.53
271.83
321.55
321.67
641.69
Here is the expected output.
Corporation Sales Report
DIV
Q1
Q2
Q3
Q4
201.24
150.91
270.83
421.51
1
312.43
422.14
251.85
732.53
271.83
321.55
321.67
641.69
Transcribed Image Text:The company has three divisions. The program uses a 2-D array of three rows and four columns. Each column represents one quarter of the year. Each row represents the sales data of one division. The program consists of a main function and another function for displaying a 2-D array passed in through arguments. The program has defined a global constant to represent the number 4 as the four quarters of an year. Use this constant identifier wherever the number 4 is required as the four quarters of a year. Write the prototype for the function named printSalesData above the main function. The function receives a 2-D array as the first argument and the number of divisions as the second argument. It returns void. The main function has a 2-D array defined and initialized. It then reads the data from user to fill the array. You need to supply the data when the program runs. Complete the call statement that calls printSalesData function with the appropriate arguments to print the report. Below the main function, write the definition of printSalseData. Test The Program with the following input. 201.24 150.91 270.83 421.51 312.43 422.14 251.85 732.53 271.83 321.55 321.67 641.69 Here is the expected output. Corporation Sales Report DIV Q1 Q2 Q3 Q4 201.24 150.91 270.83 421.51 1 312.43 422.14 251.85 732.53 271.83 321.55 321.67 641.69
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning