Oct 31, 2011 at 12:15am UTC
so im doing a project for skool...this is a part of my code...just a simple test run
and i keep getting expressions expected for the double jerry line
#include <iostream.h>
#include <conio.h>
int populate(double array1[], int number);
int main()
{
double jerry[3]={}; // the line that keeps giving errors
populate(jerry,3);
cout<< "the second value is" << jerry[1] << endl;
getch;
cin.get();
}
int populate(double array1[], int number)
{
double input;
int i;
for (i=0;i<number;i++)
{
cout<< "enter value for item"<<(i+1);
cin>>input;
array1[i]=input;
}
return i;
}
Oct 31, 2011 at 5:22am UTC
I'd venture that since you're attempting to initialize jerry (as denoted by the "+ {}", the compiler expects you to furnish values for the elements of the array. If you're not going to initialize jerry, then just declare it.
double jerry[3];
Oct 31, 2011 at 8:44am UTC
thank you so much!!!! it was getting to annoying.....stil dont understand why c++ wudnt accept it though....but w/e