<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'> <BR>
Hola a todos,<BR>
<BR>
por aca de nuevo molestando, lo que pasa es necesito hacer un Swich en C++, eso es fasil pero se me ocurrio hacerlo utilizando clases y metodos. Cuando solo dejo el primer <STRONG>CASE</STRONG> todo funciona, pero hago el segundo y ya no me funciona me sale los siguientes errores:<BR>
<BR>
<STRONG>C:\Documents and Settings\User\Escritorio\Dev C++\Estudiante.cpp In function `int main()': </STRONG><BR>
<STRONG>126 C:\Documents and Settings\User\Escritorio\Dev C++\Estudiante.cpp jump to case label </STRONG><BR>
<STRONG>119 C:\Documents and Settings\User\Escritorio\Dev C++\Estudiante.cpp crosses initialization of `Ingenieria Ing' </STRONG><BR>
<STRONG>C:\Documents and Settings\User\Escritorio\Dev C++\Makefile.win [Build Error] [Estudiante.o] Error 1</STRONG> <BR>
<BR>
que sera.........<BR>
<BR>
hay les dejo el codigo<BR>
<BR>
ahh otra cosa hay la posibilidad de colocar la hora y fecha en un programa hecho en C++<BR>
<BR>
/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/<BR>
<BR>
<FONT color=#008000><STRONG>#include <cstdlib><BR>#include <iostream><BR>#include <windows.h></STRONG></FONT><BR>
<FONT color=#008000><STRONG>using namespace std;</STRONG></FONT><BR>
<BR><FONT color=#008000><STRONG>class Estudiante<BR>{<BR> public:<BR> Estudiante(char *Nombre, char *Apellido, int Cod, float Matem1, float Ingl1);<BR> float Matem1;<BR> float Ingl1;<BR> private:<BR> char Nombre[24];<BR> char Apellido[24];<BR> int Cod;<BR>};<BR>class Ingenieria:<FONT face="">public</FONT> Estudiante<BR>{<BR> public:<BR> Ingenieria(char *Nombre, char *Apellido,int Cod, float Matem1, float Ingl1, float Algoritmos, float Programacion);<BR> float Promedio();<BR> void VerPromedio(float);<BR> private:<BR> float Algoritmos;<BR> float Programacion;<BR>};<BR>class <FONT face="">FAdministracion:<FONT face="">public</FONT></FONT> Estudiante<BR>{<BR> public:<BR> FAdministracion(char *Nombre, char *Apellido,int Cod, float Matem1, float Ingl1, float Admin1, float Contab1);<BR> float Promedio();<BR> void VerPromedio(float);<BR> private:<BR> float Admin1;<BR> float Contab1;<BR> };<BR>class Educacion:public Estudiante<BR>{<BR> public:<BR> Educacion(char *Nombre, char *Apellido,int Cod, float Matem1, float Ingl1);<BR> private:<BR> float Pedagogia;<BR> float Teoria;<BR> };<BR> <BR>Estudiante::Estudiante(char *Nombre, char *Apellido,int Cod, float Matem1, float Ingl1)<BR>{<BR> Estudiante::Cod=Cod;<BR> Estudiante::Matem1=Matem1;<BR> Estudiante::Ingl1=Ingl1;<BR>}</STRONG></FONT><BR>
<BR><STRONG><FONT style="BACKGROUND-COLOR: #ffffff" color=#008000>Ingenieria::Ingenieria(char *Nombre, char *Apellido,int Cod, float Matem1, float Ingl1, float Algoritmos, float Programacion):<BR>Estudiante(Nombre, Apellido, Cod, Matem1, Ingl1)<BR>{<BR> Ingenieria::Algoritmos=Algoritmos;<BR> Ingenieria::Programacion=Programacion;<BR>}</FONT></STRONG><BR>
<STRONG><FONT style="BACKGROUND-COLOR: #ffffff"><FONT color=#008000>FAdministracion::FAdministracion(char *Nombre, char *Apellido,int Cod, float Matem1, float Ingl1, float Admin1, float Contab1):<BR>Estudiante(Nombre, Apellido, Cod, Matem1, Ingl1)<BR>{<BR> FAdministracion::Admin1=Admin1;<BR> FAdministracion::Contab1=Contab1;<BR>}</FONT></FONT></STRONG><BR>
<STRONG><FONT style="BACKGROUND-COLOR: #ffffff" color=#008000> float Ingenieria::Promedio(){return (Matem1 + Ingl1 + Algoritmos + Programacion)/4;}<BR> float FAdministracion::Promedio(){return (Matem1 + Ingl1 + Admin1 + Contab1)/4;}</FONT></STRONG><BR>
<STRONG><FONT style="BACKGROUND-COLOR: #ffffff" color=#008000> void Ingenieria::VerPromedio(float Tpromedio){cout<<"El Promedio es: "<<Tpromedio<<endl;}<BR> void FAdministracion::VerPromedio(float Tpromedio){cout<<"El Promedio es: "<<Tpromedio<<endl;}<BR> <BR> <BR>int main()<BR>{<BR> int opcion, Cod, rept=1;<BR> float nota1, nota2, nota3, nota4;<BR> float TPromedio;<BR> char Nombre[24];<BR> char Apellido[24];<BR> system("color 1b");<BR>while(rept==1)<BR>{<BR> system("cls");<BR> <BR> cout<<" \n\t\tFundacion Universitaria Panamericana\n\n";<BR> Sleep(1000);<BR> cout<<"Seleccione su Facultad\n\n";<BR> Sleep(300);<BR> cout<<"Para Estudiantes de Ingenieria (1)\n";<BR> Sleep(300);<BR> cout<<"Para Estudiantes de Administracion (2)\n";<BR> Sleep(300);<BR> cout<<"Para Estudiantes de Educacion (3)\n";<BR> cin>>opcion;<BR>switch(opcion)<BR>{<BR>case 1:<BR> cout<<" \t\tDatos del Estudiante\n\n";<BR> Sleep(300);<BR> cout<<"Nombre : ";<BR> cin>>Nombre;<BR> cout<<"Apellido: ";<BR> cin>>Apellido;<BR> cout<<"Codigo : ";<BR> cin>>Cod;<BR> cout<<"Digitela nota de Matematicas : ";<BR> cin>>nota1;<BR> cout<<"Digitela nota de Ingles : ";<BR> cin>>nota2;<BR> cout<<"Digitela nota de Algoritmos : ";<BR> cin>>nota3;<BR> cout<<"Digitela nota de Programacion : ";<BR> cin>>nota4;</FONT></STRONG><BR>
<STRONG><FONT style="BACKGROUND-COLOR: #ffffff" color=#008000> Ingenieria Ing(Nombre, Apellido, Cod, nota1, nota2, nota3, nota4);<BR> TPromedio=Ing.Promedio();</FONT></STRONG><BR>
<STRONG><FONT style="BACKGROUND-COLOR: #ffffff" color=#008000> cout<<"\nProcesando Promedio.....\n";<BR> Sleep(1200);<BR> Ing.VerPromedio(TPromedio); <BR>break;<BR>case 2:<BR> cout<<" \t\tDatos del Estudiante\n\n";<BR> Sleep(300);<BR> cout<<"Nombre : ";<BR> cin>>Nombre;<BR> cout<<"Apellido: ";<BR> cin>>Apellido;<BR> cout<<"Codigo : ";<BR> cin>>Cod;<BR> cout<<"Digitela nota de Matematicas : ";<BR> cin>>nota1;<BR> cout<<"Digitela nota de Ingles : ";<BR> cin>>nota2;<BR> cout<<"Digitela nota de Administracion : ";<BR> cin>>nota3;<BR> cout<<"Digitela nota de Contabilidad : ";<BR> cin>>nota4;</FONT></STRONG><BR>
<STRONG><FONT style="BACKGROUND-COLOR: #ffffff" color=#008000> FAdministracion Fadm(Nombre, Apellido, Cod, nota1, nota2, nota3, nota4);<BR> TPromedio=Fadm.Promedio();</FONT></STRONG><BR>
<STRONG><FONT style="BACKGROUND-COLOR: #ffffff" color=#008000> cout<<"\nProcesando Promedio.....\n";<BR> Sleep(1200);<BR> Fadm.VerPromedio(TPromedio);<BR> break;</FONT></STRONG><BR>
<STRONG><FONT style="BACKGROUND-COLOR: #ffffff" color=#008000> //system("color 2e");<BR> return 0;<BR> }<BR> cout<<"Desea ver las notas de otro Estudiante\n";<BR> cout<<"SI (1) NO (0)";<BR> cin>>rept;<BR> }<BR>system("PAUSE");<BR> return 0;<BR>}<BR></FONT></STRONG><BR>
/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/<BR>
<BR>
Gracias.<BR><BR><BR>
<DIV>
<P align=center><FONT face="Times New Roman, Times, Serif" color=#3366cc size=4><EM></EM></FONT> </P>
<P align=center><FONT face="Lucida Handwriting, Cursiva" color=#3366cc size=6><EM>Cristhian Angarita.</EM></FONT></P>
<P align=center><FONT color=#3366cc size=4><FONT face="Lucida Handwriting, Cursiva" color=#333333 size=2><A href="http://cm85.spaces.live.com/" target=_blank>http://cm85.spaces.live.com/</A></FONT></FONT></P>
<P align=center><FONT color=#3366cc size=4><FONT face="Lucida Handwriting, Cursiva" color=#333333 size=2><A href="http://cm85.spaces.live.com/blog/cns!9AECE6BFD5898DE4!271.entry" target=_blank>http://cm85.spaces.live.com/blog/cns!9AECE6BFD5898DE4!271.entry</A></FONT></FONT></P></DIV><BR><br /><hr />Discover the new Windows Vista <a href='http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE' target='_new'>Learn more!</a></body>
</html>