Help me! why it doesn't compile?

#include <iostream>
using namespace std;

const int NUMBER_OF_PLANTS=4;

void inputData(int a[], int lastPlantNumber);

void scale(int a[], int size);

void graph(const int asteriskCount[], int lastPlantNumber);

void getTotal(int& sum);

int round(double number);

void printAsterisk(int n);

int main ()
{
int production[NUMBER_OF_PLANTS];

cout<<"This program displays a graph showing\n"
<<"production for each plant in the company.\n";

inputData(production, NUMBER_OF_PLANTS);
scale(production, NUMBER_OF_PLANTS);
graph(production, NUMBER_OF_PLANTS);
}

void inputData(int a[], int lastPlantNumber)
{
for(int plantNumber=1; plantNumber<=lastPlantNumber; plantNumber++)
{
cout<<endl
<<"Enter production data for plant number "<<plantNumber<<endl;

getTotal(a[plantNumber-1]);
}
}

void getTotal(int& sum)
{
cout<<"Enter the number of units produced by each department"<<endl;
cout<<"Append a negative number to the end of the list."<<endl;

sum=0;
int next;
cin>>next;
while(next>=0)
{
sum=sum+next;
cin>>next;
}

cout<<"Total= "<<sum<<endl;
}

void scale(int a[], int size)
{
for(int index=0; index<size; index++)
a[index]=round(a[index]/1000.0);
}

int round(double number)
{
return static_cast<int> (number+0.5);
}

void printAsterisks(int n)
{
for(int count=1; count<=n; count++)
cout<<"*";
}

void graph(const int askeriskCount[], int lastPlantNumber)
{
cout<<endl;
cout<<"Units produced in thousands of units: "<<endl;
cout<<endl;
for(int plantNumber=1; plantNumber<=lastPlantNumber; plantNumber++)
{
cout<<"Plant #"<<plantNumber<<" ";
printAsterisks(asteriskCount[plantNumber-1]);
cout<<endl;
}
}
void graph(const int askeriskCount[], int lastPlantNumber)

printAsterisks(asteriskCount[plantNumber-1]);
Last edited on
Sorry Moschops, I didn't understand the problem by your response.

When I try to compile I get:
error C2065: 'asteriskCount' : undeclared identifier


This means that it's not declared. As Moschops underlined, you've spelled this wrong.

Topic archived. No new replies allowed.