为什么num1价值等于0?我不明白.怎么会传递num1到getScore功能,并使用cin不改变价值?如何更改基于什么是它的价值cin来score.
#include <iostream>
using namespace std;
void getScore(double);
int main(int argc, const char * argv[]) {
double num1;
getScore(num1);
cout << "NUM 1 got set to " << num1 << endl;
return 0;
}
void getScore(double score) {
cout << "whats the score";
cin >> score;
cout << "num is " << score << endl;
}
Run Code Online (Sandbox Code Playgroud) c++ ×1