Comunidad de diseño web y desarrollo en internet online

Ayuda con c++

Citar            
MensajeEscrito el 21 Mar 2010 04:33 pm
Hola, esque quiero hacer un codigo para c++ y soy nuevo
y quiero ver si alguien me puede alludar con el error que me marca

Aqui les dejo mi msn: [email protected]

*Y este es el codigo en Dec C++

Código C++ :

#include <iostream>
#include <string>

using namespace std;
int main()
{
   char nombre;

   std::cout<<"Dame el Nombre";
   std::cin >> nombre;
   if (nombre=="Sofia")
   {
      cout << "FELICIDADES" << endl; 
      cout << "i i i i  i i i" << endl;
      cout << "[][][][] [][][]" << endl;
      cout << "[*Felicidades*]" << endl;
      cout << "[___SOFIA_____]" << endl;  }
   else
   {
      cout << "Usted no cumple años" << endl;   }

   return 0;
}

Por Humberto123

1 de clabLevel



 

asdimc

msie8
Citar            
MensajeEscrito el 25 Mar 2010 06:08 pm
Después de recordar los viejos tiempos en C/C++ , el siguiente código hace lo que necesitas:

Código C++ :

#include <iostream>
#include <string>

using namespace std; 
main()
{ 
   string nombre, nombre2;
   nombre = "Sofia";
 
   std::cout<<"Dame el Nombre"; 
   std::cin >> nombre2;
   if (nombre2==nombre)
   { 
      cout << "FELICIDADES" << endl;  
      cout << "i i i i  i i i" << endl; 
      cout << "[][][][] [][][]" << endl; 
      cout << "[*Felicidades*]" << endl; 
      cout << "[___SOFIA_____]" << endl;
      system ("pause");
       } 
   else 
   { 
      cout << "Usted no cumple años" << endl;
      system ("pause");
   } 
 
   return 0; 

}


Debes tener en cuenta que la mayúscula inicial del nombre afecta, o sea que cuando te pida el nombre debes escribir el nombre con la S en mayúscula. ^^

Saludos!

Por Blackdragon

Claber

3776 de clabLevel

24 tutoriales

Genero:Masculino   Premio_Secretos Héroes

In one of the pits of hell, fighting for my soul

firefox
Citar            
MensajeEscrito el 11 May 2010 11:47 pm

Humberto123 escribió:

Hola, esque quiero hacer un codigo para c++ y soy nuevo
y quiero ver si alguien me puede alludar con el error que me marca


*Y este es el codigo en Dec C++

Código C++ :

#include <iostream>
#include <string>

using namespace std;
int main()
{
   char nombre;

   std::cout<<"Dame el Nombre";
   std::cin >> nombre;
   if (nombre=="Sofia")
   {
      cout << "FELICIDADES" << endl; 
      cout << "i i i i  i i i" << endl;
      cout << "[][][][] [][][]" << endl;
      cout << "[*Felicidades*]" << endl;
      cout << "[___SOFIA_____]" << endl;  }
   else
   {
      cout << "Usted no cumple años" << endl;   }

   return 0;
}

Por Humberto123

1 de clabLevel



 

asdimc

msie8
Citar            
MensajeEscrito el 11 May 2010 11:48 pm
close

Por Humberto123

1 de clabLevel



 

asdimc

msie8

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.