请告诉我,当我调用这些功能时是否有任何错误
1 bool折扣(浮动价格,int numberOfItemsPurchased)
bool discount
float price;
int numberOfItemPurchased;
discount = discountP (price, numberOfItemPurchased)
2浮动估计控制价格(浮点数,浮动价格,布尔引线,布尔自动)
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)
答案 0 :(得分:1)
是的,没错。您传递使用与函数声明中相同类型声明的参数,并将返回值分配给正确类型的变量(如果它不是无效的。)