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"<

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education