Guest_imported
New member
- Jan 1, 1970
- 0
I am trying to figure out how to create a funtcion that passes values to an array.
Here is what I have so far.
void per_trip(int test[])
{
float miles;
float gallons;
float price;
miles = gallons = price = 0;
float sum;
float mpg;
int number;
number = 2;
miles = get_miles(miles);
gallons = get_gallons(gallons);
price = get_price(price);
sum = (price * gallons); // Cost paid for fuel
mpg = (miles / gallons); // Miles per gallon
cout << endl;
print_sum(sum, mpg);
test[ number ];
test[ 0 ] = ++miles;
test[ 1 ] = ++gallons ;
test[ 2 ] = ++price;
}
I need to pass the values of miles, gallons, and price to an array. The array needs to keep track of running totals.
I no this is wrong, and I am completely lost.
Someone please help
Thanks
Here is what I have so far.
void per_trip(int test[])
{
float miles;
float gallons;
float price;
miles = gallons = price = 0;
float sum;
float mpg;
int number;
number = 2;
miles = get_miles(miles);
gallons = get_gallons(gallons);
price = get_price(price);
sum = (price * gallons); // Cost paid for fuel
mpg = (miles / gallons); // Miles per gallon
cout << endl;
print_sum(sum, mpg);
test[ number ];
test[ 0 ] = ++miles;
test[ 1 ] = ++gallons ;
test[ 2 ] = ++price;
}
I need to pass the values of miles, gallons, and price to an array. The array needs to keep track of running totals.
I no this is wrong, and I am completely lost.
Someone please help
Thanks