Programacion

Páginas: 2 (491 palabras) Publicado: 9 de noviembre de 2011
C++ Keywords: bool |
|

Introduction |
|
The Boolean data type is used to declare a variable whose value will be set as true (1) or false (0). To declare such a value, you use the boolkeyword. The variable can then be initialized with the starting value. A Boolean constant is used to check the state of a variable, an expression, or a function, as true or false. You can declare aBoolean a variable as:C + + Palabrasclave: bool

introducción

El tipo de datos Boolean se utiliza para declarar una variable cuyo valor se establece como verdadero (1) o falso (0). Para declarar unvalor, se utiliza la palabra clave bool. La variable puede ser inicializada con el valor inicial. Una constante booleana se utiliza para comprobar el estado de una variable, una expresión o unafunción, como verdadero o falso.

Se puede declarar un valor booleano de una variable como:
bool GotThePassingGrade = true;Later in the program, for a student who got a failing grade,you can assign the other value, like this GotThePassingGrade = false;Here is an example: #include <iostream> using namespace std;//--------------------------------------------------------------------------- int main(int argc, char* argv[]) { bool MachineIsWorking = true;cout << "Since this machine is working, its value is " << MachineIsWorking << endl;MachineIsWorking = false; cout << "The machine has stopped operating. " << "Now its value is " << MachineIsWorking << endl;return 0; } //--------------------------------------------------------------------------- |

Ejemplos::::::::::::...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Programación
  • Programacion
  • Programacion
  • Programación
  • Programacion
  • Programacion
  • Programacion
  • Programacion

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS