'I can`t call the bool function in c++ (closed)
Hey guys please help me on this I have tried calling my bool function in my main func but it wont even show the first cout of program and the compiler terminates the program here is my code
#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;
}
Solution 1:[1]
Your function has parameters so you need to call them to make it work. In this case (an example):
int size = 5;
int array[5];
int start = 0;
puzzle(size, array, start);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Luis Antonio Atencio Cordova |