I'm having problems figuring out what's wrong with this line of code.
#include <iostream.h>
#include <iomanip.h>
void print(char **, char **, int**);
void enter(char**, char **, int**);
void main (void)
{
char car [10][5];
char model[10][5];
int year[5][1];
enter((char**)car,(char**)model, (int**)year);
print((char**)car,(char**)model, (int**)year);
}
void enter(char**c, char **m, int** y)
{
for (int I = 0; I<5; I++)
{
cout<<"Enter car make\n";
cin>>c[I];
cout<<"Enter car model\n";
cin>>m[I] ;
cout<<"Enter car year\n";
cin>>y[1][I];
}
}
void print(char **Car, char **Model, int** Year)
{
for (int I = 0; I<5; I++)
{
cout<<Car[I]<<setw(5)<<Model[I]
<<setw(5)<<Year[0][I]<<endl;
}
}
This is just a little thing I was experimenting with on passing two dim arrays as pointer parameters, but all I get is junk. What am I doing wrong?
Also, I want to implement a function that allows the user to search for a car make, and then it prints out the car the model and the year or error message if it doesn't find one. I was thinking of using strcmp, but can't quite figure out yet. Any help will be much apriciated.



LinkBack URL
About LinkBacks


