我正在学习 C++,并创建了一个使用 char 的简单 void 函数。我在顶部对函数进行了原型设计,在 int main 中定义它并尝试输出“你的名字是”x。有人能告诉我为什么它只告诉我“你的名字是”而不是 x (john) 部分吗?
#include <iostream>
#include <cstdlib>
#include <cmath>
void myfun(char x);
int main() {
using namespace std;
char John;
myfun(John);
system("pause");
return 0;
}
void myfun(char x) {
using namespace std;
cout << "Your name is " << x << endl;
}
想知道为什么这会被否决...也许我应该停止尝试学习 C++,因为显然没有人想帮助其他人学习