-

   rss_rss_hh_full

 - e-mail

 

 -

 LiveInternet.ru:
: 17.03.2011
:
:
: 1

:


[ ] bool true false

, 28 2017 . 13:06 +
alsoijw 13:06

bool true false

.

bool *t = new bool[X][Y];
//  
switch (t[M][N])
{
case true:
        //  
        break;
case false:
        //  
        break;
default:
        //  
        break;
}

: default? true, false. : . : ? .

. default. break. . , default, true false . . Visual Studio 2012 Windows 7 205. . , : 205. true. , : , . . : switch? .

#include 
using namespace std;

int main() {
    bool *t = new bool[1];
    switch (t[0])
    {
    case true:
        cout << "true\n";
        break;
    case false:
        cout << "false\n";
        break;
    default:
        cout << "superposition\n";
        break;
    }
    if(t[0] == true) {
        cout << "true\n";
    } else if(t[0] == false) {
        cout << "false\n";
    } else {
        cout << "superposition\n";
    }
    if(t[0]) {
        cout << "true\n";
    } else if(!t[0]) {
        cout << "false\n";
    } else {
        cout << "superposition\n";
    }
    delete[] t;
    return 0;
}

switch if . if .

? . . , , , , . .

, :

char a = t[0];
t[0] = a;
- true.
bool a = t[0];
t[0] = a;


.

Visual Studio 2013 5 Windows 7. , true, true . , default , . default.

Linux .
Original source: habrahabr.ru (comments, light).

https://habrahabr.ru/post/338898/

:  

: [1] []
 

:
: 

: ( )

:

  URL