I have this activity for programming class. I'm only allowed to place codes where it says "add code here". I managed to get some voids to work but i keep having compile error showing "too many arguments to function 'void MilesPerrGallon(double, double)'". Can anyone tell whats going on? Tnx :D
const int size=10;// use in menu[1] miles per gallon
typedef double pointers;
void MilesPerrGallon(double ptr1,double ptr2);//process and display milespergallon
void MperG();//input miles and gallons and call function MilePerGallon
void getSort();//use dynamic array and a sort techniques to sort n values
void displaySort(int ptr,int smax);//displaying the vsorted values in descending order
char displayMenu(char *pt);//display the option on screen and return values 1,2 or 3
//using a pointer variable
int main()
{
char ans,sagot;
char *ptr;
//add code here
do{
ptr=&sagot;
do
{
ans=displayMenu(ptr);
}while(ptr!='1'&&ptr!='2'&&*ptr!='3');
switch(sagot)
{
//add code here
case '1':
{
MperG();
}
break;
case '2':
{
}
break;
case '3':
{
cout<<"goodbye for now....\n";
system("pause");
exit(1);
}
exit(1);
break;
}
do
{
cout<<"Try Again?[y/n]:";
cin>>*ptr;
*ptr=tolower(*ptr);
}while(*ptr!='y'&&*ptr!='n');
}while(*ptr=='y');
cout<<endl;
cout<<"Thank you for using my program!";
system("pause>0");
return 0;
}
/////////////////////////
void MperG()
{double miles[size],gallons[size];
int ctr;
pointers milPtr,galPtr;
int msize;
I have this activity for programming class. I'm only allowed to place codes where it says "add code here". I managed to get some voids to work but i keep having compile error showing "too many arguments to function 'void MilesPerrGallon(double, double)'". Can anyone tell whats going on? Tnx :D
========================================================================
include<iostream>
include<iomanip>
using namespace std;
const int size=10;// use in menu[1] miles per gallon
typedef double pointers;
void MilesPerrGallon(double ptr1,double ptr2);//process and display milespergallon
void MperG();//input miles and gallons and call function MilePerGallon
void getSort();//use dynamic array and a sort techniques to sort n values
void displaySort(int ptr,int smax);//displaying the vsorted values in descending order
char displayMenu(char *pt);//display the option on screen and return values 1,2 or 3
//using a pointer variable
int main()
{
char ans,sagot;
char *ptr;
//add code here
do{
ptr=&sagot;
do
{
ans=displayMenu(ptr);
}while(ptr!='1'&&ptr!='2'&&*ptr!='3');
}
/////////////////////////
void MperG()
{double miles[size],gallons[size];
int ctr;
pointers milPtr,galPtr;
int msize;
/*********/
cout<<"GALLONS\n";
//add code here
cout<<"The number must be from 5-25 only.\n\n";
//call MilePerrGallon here
MilesPerrGallon(milPtr,galPtr,msize);
}
////////////////////////
void MilesPerrGallon(double ptr1,double ptr2)
{
}
///////////////////////////////////////
void getSort()
{
//add code here
//call displaysort here
void displaySort(int *ptr,int smax);
}
/////////////////////////
void displaySort(int *ptr,int smax)
{
//add code here
}
////////////////////////////////////////////
//////////////////////////////////////////
char displayMenu(char pt)
{
//add code here
cout<<"MAIN MENU"<<endl <<"<span="">[1] - MPG (Miles Per Gallon)"<<endl <<"<span="">[2] - Sorting of Numbers"<<endl <<"<span="">[3] - Exit Program"<<endl <<"Enter="" Option:="" ";="" cin="">>pt;
return *pt;
}
Last edit: Robbert Williams 2016-05-15