Some help needed

Write your question here.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
  #include <iostream>
#include <iomanip>
#include <ctime>

using namespace std;

int main()
{

    const int rows = 10;
    const int colms = 10;
    
    bool land(int location);
    
    int nums[rows] [colms];
    
    cout << "  | 0 1 2 3 4 5 6 7 8 9" << endl;
    cout << "--+--------------------" << endl;
    
    const int min = 0;
    const int max = 1;
    
    srand(time(0));
    
    for(int i = 0; i < colms; i++ )
    {
        for(int j = 0; j < rows; j++)
        {
            nums[i] [j] = (rand() % (max - min +1 ) + min);
        }
    }
    
    for(int i = 0; i < rows; i++)
    {
        cout << i << " | " ;
        
        for(int j = 0; j < colms; j++)
        {

            if (nums[ i ] [j] == 0 )
            {
                cout << " 0" ;
            }
            
            else
            {
                cout << " " ;
            }
            
            cout << "Enter (x, y) coordinates: ";
            cin >> i >> j;
            
            land = true;
            return 3;
            
            if(land == true)
            {
                return 3;
            }

            if(land == false)
            {
                cout << "CRASH! Try again!" << endl;
            }
            
            
            
        } 
        
        cout << endl;
        
    }
}

bool land (int location)
{
    if(location == 1)
    {
        return true;
    }
    
    else
    {
        return false;
    }
}
I know there is someting wrong with my boolean type, and I am not sure how to fix it, please help me.
This is exactly the same code as this thread:

http://www.cplusplus.com/forum/general/244667/


Are you trolling?
First bool land(int location);, this one is a prototype that you use as a function later at line 75.

You're using this prototype as a normal variable at line 53, 56 and 61.
Topic archived. No new replies allowed.