//Don't mind the whole class nonsense
#include <iostream>
#include <string>
#include "Fish.h"
usingnamespace std;
void inputData(constint *const, Fishing*);
int main()
{
Fishing *fishData;
int fishnum,
*pnum=&fishnum,
option;
cout<<"Enter the number of fish caught: ";
cin>>*pnum;
while(*pnum<0)
{
cout<<"ERROR. Please enter a positive value: ";
cin>>*pnum;
}
fishData=new Fishing[fishnum];
inputData(pnum,fishData);
}
//Gives error if I don't include the [] after "data" pointer array
void inputData(constint *const num, Fishing *data)
{
string strVar;
double doubVar;
for(int i=0;i<(*num);i++)
{
cout<<"Enter data for fish #"<<(i+1)<<": "<<endl;
cout<<"Type: ";
cin>>strVar;
//Giving me error here, fixes when I add [] to the top of function
data[i]->setFishType(strVar);
}
}
#include <iostream>
#include <cstdlib>
usingnamespace std;
void displayAll(constint *const, int);
int main()
{
constint NUM=5;
int num[NUM]={1,2,3,4,5};
int *numpt=num;
displayAll(num,NUM);
}
//No [] on the pointer array yet it runs just fine
void displayAll(constint *const arr, int NUM)
{
for(int i=0;i<NUM;i++)
{
cout<<arr[i]<<endl;
}
}