I am having a bit of problem understanding why the compiler is shouting at me that I have an undeclared variable.
This bit of code works:
Code:
void line(int n, char c)
{
cout << callnumber << ": " ;
for (int i = 0; i < n; i++)
{
cout << c ;
}
cout << endl ;
}
But this code gives me the following errors :
barchart.cc: In function `void hyphen(int)':
barchart.cc:7: `i' undeclared (first use this function)
barchart.cc:7: (Each undeclared identifier is reported only once
barchart.cc:7: for each function it appears in.)
Code:
void hyphen(int a)
{
for (i = 0; i < a; i++)
{
cout << "-" ;
}
cout << endl ;
}