Ver Mensaje Individual
  #3 (permalink)  
Antiguo 17/12/2013, 01:16
Avatar de vangodp
vangodp
 
Fecha de Ingreso: octubre-2013
Mensajes: 934
Antigüedad: 11 años, 4 meses
Puntos: 38
Respuesta: [C++]Comprobando la existencia de palabras con un if

Código C++:
Ver original
  1. #include <iostream>
  2. #include <windows.h>
  3. //#include <string.h>
  4.  
  5. using namespace std;
  6.  
  7. int main (){
  8.  
  9.     char a [20]= "constante";
  10.     char b [20]= "constante";
  11.     char c [20]= "constantine";
  12.  
  13.     if (strcmp(a,b) == 0){
  14.         cout << "a y b SI son iguales:\t" << a << "==" << b << endl;
  15.     }
  16.  
  17.     if (strcmp(a,c) != 0){
  18.         cout << "a y c NO son iguales: \t" << a << "!=" << c << endl;
  19.     }
  20.    
  21.    
  22.  
  23.     system("pause>null");
  24.     return 0;
  25. }

observe que el include string.h esta como comontario, creo que iostream cumple con esa funcion.
Caso no te ande quitale el // de string.h