Professional Documents
Culture Documents
Isaac Bernal
9/8/2022
Programming Fundamentals 3
Professor Lara
In this program, I am making use of the pointers through functions in this Mileage Calculator
*/
#include <iostream>
#include <cmath>//using division
#include <string>//user's info
using namespace std;
//------Prototype-----------
void input(string *, int *, float *, float *);//to gather users info with pointers
float cal(float *,float *); //calculating the mileage
void display(int *, string *, float *);
int main()
{
float gallon;
float *galPtr = &gallon;//address of variable assigned to pointer
float miles;
float *milPtr = &miles;//address of variable assigned to pointer
float mPg;
float *mpgPtr= &mPg;//address of variable assigned to pointer
string carMakeModel;
string *carInfoPtr = &carMakeModel;//address of string variable assigned to pointer
int carYear;
int *yearPtr = &carYear;
//----Call to Function----
input(carInfoPtr, yearPtr, galPtr, milPtr);
//-------Function Definition-------