Please tell me if there is any error when I am calling these functions
1 bool discount (float price, int numberOfItemsPurchased)
bool discount
float price;
int numberOfItemPu开发者_StackOverflowrchased;
discount = discountP (price, numberOfItemPurchased)
2 float estimatePetrolPrice (float kms, float price, bool leaded, bool automatic)
float estimatePrice;
float kms;
float price;
bool leaded;
bool automatic;
estimatePrice = estimatePetrolPrice (kms, price, leaded, automatic)
3 void getData (string & name, string & dateOfBirth, int & age)
string name;
string dateOfBirth;
int age;
getData (name, dateOfBirth, age)
4 void getVal ( int & item, int & inter, char decflag)
int item;
int inter;
char decflag;
getVal (item, inter, decflag)
Yes, that's right. You pass arguments declared with the same type as in the function's declaration, and assign the return value to a variable of the right type if it isn't void.
精彩评论