可能具有指针函数的模糊赋值
Vague Assignment with possible pointer function
这是一个类赋值,我必须在没有太多细节的情况下弄清楚程序中发生了什么,然后让它发挥作用。看起来函数可能打算在原型中使用指针类型int,但在定义中没有*。我可以根据需要自由更改代码,但我应该保留函数。有什么建议吗?
// Question4
//
// This question has no instructions, simply make it work properly.
// (Ask for a number and print it out.) Keep the function.
//
#include <iostream>
void MyFunc( int * ) ;
int main()
{
int i = 0;
cout << “Enter an integer: " << endl;
cout << "The value entered is: " << MyFunc(i) << endl;
}
void MyFunc( int x )
{
cin >> x ;
cout << "nnn";
return x;
}
任一:
- 使函数返回int
- 让函数返回像int一样打印的东西(有点棘手,用于测试你的老师)
- 将参数设为int引用并返回该引用
相关文章:
- 为"adjacent"变量赋值时出现问题
- C++中的赋值发生,尽管右侧出现异常
- 用C++中的sscanf赋值
- 为std::string的某个索引赋值
- 重载Singly Linked List中的赋值运算符
- 为什么我必须在C++中添加一个赋值符号来声明一个数组
- gtest_使用setargpointee在函数中赋值
- 非常量变量只读位置的赋值
- 使用赋值运算符重载从类中返回jobject
- C++数据文件、数组和计算赋值
- 为什么在使用转换构造函数赋值后调用C++类的析构函数?
- 全局作用域中函数指针的赋值
- 错误:在为指针赋值时,void值没有被忽略
- 标准库类型的赋值运算符的引用限定符
- 关于 c++ 函数中指针赋值的简单问题
- 复制构造函数、赋值运算符C++
- 标准::变体的赋值运算符
- cin >> int 给定一个字符串将 int 赋值为 0
- if 子句中的赋值不起作用
- 可能具有指针函数的模糊赋值