我无法在 c++ 中调用布尔函数(已关闭)
I can`t call the bool function in c++ (closed)
嘿伙计们请帮帮我,我已经尝试在我的主函数中调用我的布尔函数,但它甚至不会显示程序的第一个分支,编译器终止程序这是我的代码
#include <iostream>
using namespace std;
bool puzzle(int size, int array[], int start)
{
cout <<"how many blocks you want for the puzzle? n";
cin >> size;
for (int i = 0; i < size; i++)
{
cout << "enter your numbers in order for the blocks:n";
cin >> array[i];
if (array[0] > size) { return false; };
if (array[0] == size) { return true; };
}
}
int main()
{
puzzle;
return 0;
}
您的函数具有参数,因此您需要调用它们才能使其工作。在这种情况下(示例(:
int size = 5;
int array[5];
int start = 0;
puzzle(size, array, start);
相关文章:
- 在没有定义返回类型的函数中返回布尔值,并将结果保存在无错误的char编译中-为什么
- 如何编写一个使用n倍三元条件语句的C++布尔函数
- 将此布尔值传递给此函数的最有效方法是什么?
- 为什么我不能在返回 const 的布尔函数中为类成员变量赋值?C++
- 程序中的布尔函数返回输入的范围无论如何都是无效的
- 类中的虚拟布尔函数参数不起作用
- 不能制作需要布尔成员函数的C++20概念
- 存储另一个函数返回的布尔数组时遇到问题
- 我无法在 c++ 中调用布尔函数(已关闭)
- 如何创建两个具有相同名称和不同返回类型并基于布尔参数运行的函数
- 如何使用返回布尔值的函数?
- 函数的返回值类型是别名 ***或 *** 布尔值
- 将二维布尔值传递给函数
- C++ 这里有一个返回 (24) 的布尔返回类型函数
- 如何将值初始化为返回类型为布尔值的函数?
- 如何使用布尔函数按降序对数组进行排序?
- 在布尔函数 c++ 中使用 elses
- 布尔函数在一段时间内不起作用
- 我正在尝试创建一个布尔函数,该函数计算字符并在字符为"()*-+"时返回 true
- 递归函数、布尔语句和输入C++