[PHP]#include <iostream>
#include <vector>
using std::cout;
using std::cin;
using std::endl;
int main(void)
{
int x;
x=0;
while ( x < 3 )
{
int m1;
int m2;
int m3;
int a[] ={m1,m2,m3};
cout<<"Enter the Miles used (-1 to quit):" << endl;
cin>> a[x];
cout<<"Enter gallons:" << endl;
int f1;
int f2;
int f3;
int b[] ={f1,f2,f3};
cin>> b[x];
int k1;
int k2;
int k3;
int MPG[]={k1,k2,k3};
MPG[x]=a[x]/b[x];
int * mypointer;
mypointer=MPG[x]; *mypointer=???? ?;
mypointer++; *mypointer=???? ?;
mypointer = &MPG[x]; *mypointer=???;
for (int n=0; n<3; n++)
cout << MPG[n] << ", ";
cout << "MPG this tankful:" << MPG[x] << endl;
// cout << "Total MPG:" << TMPG << endl;
x++;
}
char holdscr;
cout << "\n\n\t*** Enter a character and press return to exit the program! ***\n\n\t"<< std::endl;
cin >> holdscr;
return 0;
}[/PHP]
I have no idea what im doing, but it's supposed to keep the values of MPG and then i need to average them at the end so i need to save 3 different output values.
However I don't know how to specify it in the ???? mark part, I need it to point to the First value of my MPG[x] array and store the # in a variable or something.
#include <vector>
using std::cout;
using std::cin;
using std::endl;
int main(void)
{
int x;
x=0;
while ( x < 3 )
{
int m1;
int m2;
int m3;
int a[] ={m1,m2,m3};
cout<<"Enter the Miles used (-1 to quit):" << endl;
cin>> a[x];
cout<<"Enter gallons:" << endl;
int f1;
int f2;
int f3;
int b[] ={f1,f2,f3};
cin>> b[x];
int k1;
int k2;
int k3;
int MPG[]={k1,k2,k3};
MPG[x]=a[x]/b[x];
int * mypointer;
mypointer=MPG[x]; *mypointer=???? ?;
mypointer++; *mypointer=???? ?;
mypointer = &MPG[x]; *mypointer=???;
for (int n=0; n<3; n++)
cout << MPG[n] << ", ";
cout << "MPG this tankful:" << MPG[x] << endl;
// cout << "Total MPG:" << TMPG << endl;
x++;
}
char holdscr;
cout << "\n\n\t*** Enter a character and press return to exit the program! ***\n\n\t"<< std::endl;
cin >> holdscr;
return 0;
}[/PHP]
I have no idea what im doing, but it's supposed to keep the values of MPG and then i need to average them at the end so i need to save 3 different output values.
However I don't know how to specify it in the ???? mark part, I need it to point to the First value of my MPG[x] array and store the # in a variable or something.
Comment