gpt4 book ai didi

C++ Noob 函数无法计算出调用的参数?

转载 作者:行者123 更新时间:2023-11-27 23:27:50 25 4
gpt4 key购买 nike

我无法弄清楚调用的参数!这些是我的原型(prototype):

void printIdInfo(ofstream &, string , string , const string, string, const string);
void getreadExpression(ifstream &fin, double &operand1, char &oper, double &operand2);
void echoExpression (ofstream &fout, double &, char &, double &);

这些是我的定义,低于主要...

void getprintIdInfo (ofstream &fout, string &first_name, string &last_name, const string CLASS, string lecture_section, const string DUE_DATE) {
fout << first_name << " " << last_name << endl
<< CLASS << lecture_section << endl << DUE_DATE << endl;
}

void readExpression (ifstream &fin, double &operand1, char &oper, double &operand2) {
fin >> operand1 >> oper >> operand2;
}

void echoExpression (ofstream &fout, double & operand1, char &oper, double &operand2) {
fout << operand1 << " " << oper << " " << operand2;
}

这些是我的电话,但它们在我的所有参数下都不起作用,这没有意义,但我不知道如何更正它。提前致谢。

printIdInfo(ostream & out, first_name&, last_name&, lecture_section&);
getreadExpression(fin&, operand1&, oper&, operand2&);
echoExpression(fout&, operand1&, oper&, operand2&);

最佳答案

调用电话时,请勿使用“&”符号。在原型(prototype)中已经确定它是对变量的引用。当您在调用中使用 & 符号时,您正在执行二进制 AND 运算。

关于C++ Noob 函数无法计算出调用的参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8043666/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com