K
kohvirus
Well after embaressing myself and posting in the wrong fourm, I found
my way to the right one and I'm hoping to seek some help. This is the
program without any modifications that I am making recently (because
I'll most likely make it blow up moreso).
I'm currently trying to write a program with an array but for the life
of me I can't seem to get the right syntax for the array. Here is the
program as follows:
#include <iostream>
#include <stdio.h>
void display(int A[] [], int m, int n)
{
int i;
int j;
std::cout << "Enter your value for m ";
std::cin >> m;
std::cout << "\n";
for (i =0; i< m; i++)
{ for (j=0; j < n; j++)
cout << " " << A[j];
cout << "\n";
}
}
Sorry if the way I write makes you cringe, still learning to to make
code 'neat'. Anyway, here are the error outputs I am getting and I am
unable to resolve any further:
fail.cpp:9: declaration of `A' as multidimensional array
fail.cpp:9: must have bounds for all dimensions except the first
fail.cpp: In function `void display(int, int)':
fail.cpp:21: `A' undeclared (first use this function)
fail.cpp:21: (Each undeclared identifier is reported only once
fail.cpp:21: for each function it appears in.)
Any help at narrowing the problem would be appreciated. I'm using this
to test for a CGI program I will be creating here soon.
Thanks!
my way to the right one and I'm hoping to seek some help. This is the
program without any modifications that I am making recently (because
I'll most likely make it blow up moreso).
I'm currently trying to write a program with an array but for the life
of me I can't seem to get the right syntax for the array. Here is the
program as follows:
#include <iostream>
#include <stdio.h>
void display(int A[] [], int m, int n)
{
int i;
int j;
std::cout << "Enter your value for m ";
std::cin >> m;
std::cout << "\n";
for (i =0; i< m; i++)
{ for (j=0; j < n; j++)
cout << " " << A[j];
cout << "\n";
}
}
Sorry if the way I write makes you cringe, still learning to to make
code 'neat'. Anyway, here are the error outputs I am getting and I am
unable to resolve any further:
fail.cpp:9: declaration of `A' as multidimensional array
fail.cpp:9: must have bounds for all dimensions except the first
fail.cpp: In function `void display(int, int)':
fail.cpp:21: `A' undeclared (first use this function)
fail.cpp:21: (Each undeclared identifier is reported only once
fail.cpp:21: for each function it appears in.)
Any help at narrowing the problem would be appreciated. I'm using this
to test for a CGI program I will be creating here soon.
Thanks!