• Viernes 9 de Mayo de 2025, 22:29

Mostrar Mensajes

Esta sección te permite ver todos los posts escritos por este usuario. Ten en cuenta que sólo puedes ver los posts escritos en zonas a las que tienes acceso en este momento.


Mensajes - borca

Páginas: 1 2 [3]
51
C/C++ / Re: POR FAVOR ES MUY IMPORTANTE¡¡¡¡¡¡¡¡¡¡¡¡
« en: Miércoles 6 de Marzo de 2002, 10:51 »

52
C/C++ / Re: POR FAVOR ES MUY IMPORTANTE¡¡¡¡¡¡¡¡¡¡¡¡
« en: Miércoles 6 de Marzo de 2002, 10:50 »
Citar
PoR FAVOR NECESITO AYUDA URGENTEMENTE,NECESITO UN PROGRAMA DE ESTRUCTURAS DINAMICAS CON UN MENU CON VENTANAS Y FUNCIONES EN C++,DONDE SE PUEDAN INTRODUCIR,ELIMINAR,MODIFICAR..DATOS,PORFAVOR ES URGENTE, MUCHISIMAS GRACIAS :(

53
C/C++ / Re: Please! codigo source de TORRES DE HANOI
« en: Martes 26 de Febrero de 2002, 12:35 »
!! Gracias Avalon y rafael por las respuestas;)
pero hay algo que no comprendo bien...trabajando recursivamente en la funcion torres, la que realiza los movimientos
if(numdiscos==1)
moverdisco(fuente,destino);
else{
torres(fuente,auxiliar,destino,numdiscos-1);
moverdisco(fuente,destino);
torres(auxiliar,destino,fuente,numdiscos-1);

por que se hace un llamada de nuevo con numdiscos-1...donde se trata el disco numdisco????

54
C/C++ / Re: Please! codigo source de TORRES DE HANOI
« en: Lunes 25 de Febrero de 2002, 13:15 »
Si alguien tiene o sabe el codigo source del juego de torres de hanoi...porfavor haganmelo saber, lo necesitare para sacar unas ideas de codigos recursivos....torres de hanoi es el tipico juego donde hay tres torres y hay que organizar unos platos en forma creciente ;)

55
C/C++ / Problemita!! Faul: access violation
« en: Domingo 17 de Febrero de 2002, 21:38 »
bueno estoy trabajando con funciones templates, implemetandolo en una lista..al momento de la compilacion me aparece Fault: access violation...Quien me podria decir cual es el [ERROR]
Gracias;)

#include <iostream.h>
#include <iomanip.h>
#include <conio.h>
#include <stdlib.h>

template <class U>
class Liste {
  class Elem {
    friend class Liste<U>;
    U info;
    Elem *next;
    Elem (): info(0), next(NULL) {}
    Elem (U i, Elem *p): info(i), next(p) {}
  };
  Elem *head;
  void Eliminer();  //fonct qui elimine tous les èlèm de las liste
public:
  U Ins(U i);      //insére en tête
  U Tete();        //retourne l'information pointée par tête
  bool Vide () const ;      // Vide
  void Print () const;      // Print
  Liste Suite();                // Suite
  Liste(): head(NULL) {};   //Constr
  Liste& operator= (const Liste&); //operator
  Liste (const Liste&);  //copy constr
  ~Liste ();              //Destr
 };


//-----------------------------------------------------------------

template <class U>
void Liste<U>::Eliminer() {

  Elem* q;
   for (Elem* p = head; p!=NULL; p = q)
      { q = p->next; delete p; }
}

//--------------------------------------------------------------
template <class U>        //insere l'èlèment en tête
U Liste<U>::Ins(U i){
{
 head = new Elem(i, head);
} return (head->info); }

template <class U>       //retourne l'information pointée par la tête
U Liste<U>::Tete() {
return head->info;
}

template <class U>     //élimine ce qui est pointée par tête
Liste Liste<U>::Suite() {  //et tête passe un élément après
  if (!Vide()) {
   Elem* p=head;
   head=head->next;
   p->next=NULL;
   delete p;
 } return *this;

}

template <class U>           //imprime l'information de chaque élém de la liste
void Liste<U>::Print() const {
 for(Elem *f=head; f!=NULL; f=f->next)
 cout << f->info << setw(3);
}

template <class U>       //teste si la tête ne pas vide
bool Liste<U>::Vide() const{

return !head ;
}


//-----------------------------------------------------------------

template <class U>           //assigne à une nouvelles liste la liste courrante
Liste<U>& Liste<U>::operator= (const Liste& S) {
   if (this!= &S) { Eliminer();
   Elem** q = &head;
   for( Elem *p= S.head; p!=NULL; p=p->next)
     { *q= new Elem(p->info, *q); q = & (*q)->next; }
 }  return * this;
}

template <class U>           //copy constr
Liste<U>::Liste (const Liste& S) {
 Elem** q = &head;
 for (Elem* p=S.head; p; p=p->next)
    {  *q = new Elem (p->info, head); q = & (*q)->next; }
}

template <class U>          //le destr apelle la fonct Eliminer
Liste<U>::~Liste() {
Eliminer(); }
//-------------------------------------------------------------



/*main () {
  {
    clrscr();
   Liste<char> L1;

   cout << L1.Vide() << endl;
   L1.Ins('A'); L1.Ins('L'); L1.Ins('V');
   cout << "Print for L1" << endl;
   cout << L1.Tete() << endl;
   L1.Print();
   L1.Suite();
   cout << endl << L1.Vide() << endl;
   L1.Print();
   //Liste<char> L2;
   //L2=L1;
//   cout << "Print for L2 " << L2.Vide() << endl;
   //L2.Suite();
   //L2.Print() ; cout << endl << L2.Vide() << endl;
  } return EXIT_SUCCESS;
}
  */

  main () {
  {
    clrscr();
   Liste<int> L1;
   L1.Ins(6); L1.Ins(3); L1.Ins(5); L1.Ins(1);
   cout << "Print for L1" << endl << L1.Tete() << endl;
   L1.Print();
   L1.Suite();
   cout << endl << L1.Vide() << endl;
   L1.Print();
    Liste<int> L2;
   L2=L1;
   L2.Ins(13);
   cout << endl << "Print fot L2" << endl << L2.Vide() << endl;
   L2.Print() ; cout << endl << L2.Vide() << endl;

  }  return EXIT_SUCCESS;

56
C/C++ / Re: Clases & punteros... y un poco de listas dinamicas
« en: Domingo 17 de Febrero de 2002, 21:32 »
aqui tienes un ejemplo de una clase Flight.


#include "flight.h"
#include <iostream.h>
#include <iomanip.h>
#include <string.h>

class Flight {
public:
 void init (char flight_no[],
            int dep_h, int dep_m,
            int arr_h, int arr_m);
 void info ();
 void delay(int min);
private:
 char no[7];
 clock dep, arr;
};
void Flight::init (char flight_no[],
            int dep_h, int dep_m,
            int arr_h, int arr_m);
{
 strcpy(no, flight_no);
 dep.set(dep_h, dep_m, 0);
 arr.set(arr_h, arr_m, 0);
}
void Flight::info()
{
 cout << "flight no " << no;
 cout << ", Dep "; dep.write(false);
 cout << ", Arr "; arr.write(false);
 cout << ednl;
}
void Flight::delay(int min)
{
 for(int i=1; i<=min*60; i++)
  dep.tick();
 for (int j=1; j<=min*60; j++)
  arr.tick();
}

57
C/C++ / Re: Clases & punteros... y un poco de listas dinamicas
« en: Domingo 17 de Febrero de 2002, 21:28 »
Las clases como ya habia dicho jpastor, son como estructuras en c, pero en c++ es algo mas avanzado!...por ejemplo puedes definir una clase "vuelo" donde tendras funciones que llevara en tiempo de salida del avion , el tiempo de retardo, cuatos puestos sobran...etc, como ya t imaginaras son bastantes interesantes, ya que en una estructura de estas podras crear loq ue se te la gana...es uno de los aspectos mas importantes de C++ :D

58
ASM (Ensamblador) / Re: cuantos bytes????
« en: Jueves 14 de Febrero de 2002, 22:51 »
Hola a todos...quien me podria decir con cuantos bytes se trabaja compilando con borland un codigo asm????

59
C/C++ / Re: Saludos
« en: Martes 12 de Febrero de 2002, 12:14 »
Hola a toda la comunidad!! un saludo a los webmaster y que sigan en pie con la idea que esta de puta madre...soy estudiant en  informatica y he trabajado bastante en c++ entonces si necesitan alguna ayuda...o si alguna vez me pueden colaborar!! :p

60
C/C++ / Re: Nuevo en C - i need help-
« en: Martes 12 de Febrero de 2002, 00:20 »
Hola!!!
Yo trabajo en borland y la funcion que t limpia la panatlla es: clrscr()  la encuentras en la libreria <conio.h>  

Páginas: 1 2 [3]