elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Arreglado, de nuevo, el registro del warzone (wargame) de EHN


  Mostrar Temas
Páginas: [1] 2
1  Programación / PHP / Alguien me orienta en: 18 Enero 2016, 14:39 pm
Tengo este codigo:

Código
  1. public function CalcPrestamo($monto, $interes, $tiempo){
  2.                $this->monpre = $monto;
  3.                $this->intpre = $interes;
  4.                $this->timepre = $tiempo;
  5.  
  6.                $interes /=100;
  7.  
  8.                $int = $monto * $interes;
  9.                $pagCap = $monto / $tiempo;
  10.                $cuotas = $int + $pagCap;
  11.                $amort = $cuotas - $pagCap;
  12.                $vf = $monto + $int;
  13.  
  14.                echo "<HR />";
  15.                echo "<h3><strong>Calculos del Prestamo</strong></h3>";
  16.  
  17.                echo '<table width="361" border="0" cellspacing="2" cellpadding="1">';
  18.                echo "<tr>";
  19.                echo "<td width='295'><div align='right' class='style2'>MONTO: </div></td>";
  20.                echo '<td width="56"><div align="right" class="style2">'.$monto.'</div></td>';
  21.                echo '</tr>';
  22.                echo '<tr>';
  23.                echo '<td width="295"><div align="right" class="style2">INTERES:</div></td>';
  24.                echo '<td width="56"><div align="right" class="style2">'. $int .'</div></td>';
  25.                echo '</tr>';
  26.                echo '<tr>';
  27.                echo '<td width="295"><div align="right" class="style2">TIEMPO DE PAGO:</div></td>';
  28.                echo '<td width="56"><div align="right" class="style2">'.$tiempo.'</div></td>';
  29.                echo '</tr>';
  30.                echo "<tr>";
  31.                echo '<td width="295"><div align="right" class="style2">CUOTA</div></td>';
  32.                echo '<td width="56"><div align="right" class="style2">'.$cuotas.'</div></td>';
  33.                echo "</tr>";
  34.                echo "</table>";
  35.                echo "<br />";
  36.  
  37.                echo "<table class='tableloans' align='center'>";
  38.                            echo "<tr>";
  39.                                echo "<th align='center'>TIEMPO</th>";
  40.                                echo "<th align='center'>CUOTA</th>";
  41.                                echo "<th align='center'>INTERES</th>";
  42.                                echo "<th align='center'>AMORTIZACION</th>";
  43.                                echo "<th align='center'>T AMORTIZADO</th>";
  44.                            echo "</tr>";
  45.  
  46.                        for($i = 1; i <= $tiempo; $i++){
  47.                            echo "<tr>";
  48.                                echo "<td align='left'>".$tiempo . "</td>";
  49.                                echo "<td align='left'>".$cuotas . "</td>";
  50.                                echo "<td align='left'>".$int . "</td>";
  51.                                echo "<td align='left'>".$amort . "</td>";
  52.                                echo "<td align='left'>".$vf . "</td>";
  53.                            echo "</tr>";
  54.                        }
  55.                        echo "<table>";
  56. //aqui no me imprime nada
  57.            }
  58.  

Gracias de ante mano!!!
2  Programación / Bases de Datos / Necesito algunas Sugerencias en: 4 Enero 2016, 06:33 am
Cuales tablas podria crear para un Sistema de Prestamos

Ya tengo:

Cliente
Prestamo
DetallePrestamo

Alguien me puede ayudar si no es mucha molestia
3  Programación / Programación C/C++ / Ayuda por favor un error en: 19 Mayo 2015, 03:22 am
Tengo esta funcion amigos, antes de uso un deque<cEstudiante> dEstudiante

Código
  1. void eliminar_estudiante(){
  2.    int cont = -1;
  3.    char op;
  4.    string matricula;
  5.    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Yellow);
  6.    cout<<"      ---------------------------------------------------------------------\n";
  7.    cout<<"             <<<<<<<<<<     ESTUDIANTES->ELIMINAR        >>>>>>>>>>";
  8.    cout<<"\n      ---------------------------------------------------------------------\n";
  9.    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
  10.    cout<<endl;
  11.    cout<<"\n\tELIMINAR UN ESTUDIANTE";
  12.    cout<<"\n\n\tIngrese la posici\242n:"; cin>>matricula;
  13.    for(it=dEstudiante.begin(); it!=dEstudiante.end(); ++it){
  14.        cEstudiante PrintEstudiante = *it;
  15.            if((*it) == matricula){      
  16.  dEstudiante.erase(find(dEstudiante.begin(),dEstudiante.end(), matricula));
  17.   deque<dEstudiante>::iterator itTemp = --it;
  18.               cont++;  
  19.               cout<<"\n\n\tREGISTRO ELIMINADO...!!!!!\n";    
  20.               }
  21.               } if (cont == -1){
  22.                       cout<<"\n\tMATRICULA INCORRECTA...!!\n";
  23.               }cont = -1;
  24.        do{
  25.  
  26.        cout<<"\n\n\tDesea seguir eliminando? <S/N>: ";
  27.        cin>>op;
  28.        switch(op){
  29.            case 's':   system("cls");
  30.                        eliminar_estudiante();
  31.                        break;
  32.            case 'S':   system("cls");
  33.                        eliminar_estudiante();
  34.                        break;
  35.            case 'n':   return ;
  36.  
  37.            case 'N':   return ;
  38.  
  39.            default: cout<<"\n\t Ingrese una opcion valida";
  40.            }
  41.    }while(op=='y'||op=='Y');
  42. }

Me da error:
265 C:\Users\JuanaG\Programacion\Estructura de Datos\DataBases.cpp no match for 'operator==' in '(&it)->std::_Deque_iterator<_Tp, _Ref, _Ptr>::operator* [with _Tp = cEstudiante, _Ref = cEstudiante&, _Ptr = cEstudiante*]() == matricula'
4  Programación / Programación C/C++ / Alguien me da una idea de crear un programa usando grafos en C++ en: 12 Mayo 2015, 17:58 pm
Necesito hacer un programa en C++ que me imprima los cargos de una empresa en orden jerarquicos usando Grafos y no tengo idea de como hacerlo.

Alguna sugerencia?
5  Programación / Programación C/C++ / Ayuda en este codigo por favor en: 4 Mayo 2015, 23:29 pm
Tengo este codigo en C++:

Código
  1. #include <iostream>
  2. #include <stdlib.h>
  3.  
  4. using namespace std;
  5.  
  6. main(){
  7.  
  8. int i, j, filas, columnas, suma_dp=0;
  9. cout << "Ingrese el n\243mero de filas de la matriz: ";
  10. cin >> filas;
  11. cout << "Ingrese el n\243mero de columnas de la matriz: ";
  12. cin >> columnas;
  13.  
  14. if((filas < 1 || columnas < 1) || (filas > 20 || columnas > 20)){
  15. cout << "La matriz no puede ser menor que 1 ni mayor que 20\n\n";
  16. }
  17. else{
  18. cin.get();
  19. float **a = new float*[filas];
  20. cout << endl;
  21. for(i=0; i < filas; i++){
  22. a[i] = new float[columnas];
  23. for(j=0; j < columnas; j++){
  24. cout << "Ingrese el elemento A[" << i + 1 << "][" << j + 1 << "]: ";
  25. cin >> a[i][j];
  26. }
  27. }
  28. cout << endl;
  29. cout << "La matriz digitada es: " << endl;
  30. for(i=0; i < filas; i++){
  31. cout<<"|";
  32. for(j=0; j < columnas; j++){
  33. cout << "\t" << a[i][j] <<"\t";
  34. }
  35. cout << "|" << endl;
  36. }
  37.  
  38. cout << "La diagonal principal es: " << endl;
  39. for(i=0; i < filas; i++){
  40. cout<<"|";
  41. for(j=0; j < columnas; j++){
  42. if(a[i]==a[j])
  43. cout << "\t" << a[i][j];
  44. if(i-j == 0)
  45. suma_dp += a[i][j];
  46. }
  47. cout << "|" << endl;
  48. }
  49. cout << "La suma es: " << suma_dp;
  50.  
  51. }
  52. cout << endl;
  53. system("pause");
  54. return EXIT_SUCCESS;
  55.  
  56. }

Quiero hacerlo usando la STL.

Alguien me orienta?

PTDA: Se trabajar con Vectores de una dimensión usando la STL
6  Programación / Programación C/C++ / Sugerencias! en: 13 Marzo 2015, 03:56 am
Tengo esta funcion para agregar un string a un vector, pero con la condicion de no  tener nombres repetidos pero me explota el programa.

Código
  1. void addNomEst(){
  2.                  system("cls");
  3.                  cout<<"\n\n\t   <<<<<<<<<<<<<<<<<<<<MENU INSERTAR>>>>>>>>>>>>>>>>>>>>>>>\n\n\n";
  4.                  string nombre;
  5.                  int PosNom= 0, j=0;
  6.                  cout<<"Digite el nombre que desea agregar: ";
  7.                  cin.ignore(256,'\n');
  8.                  cin >> nombre;
  9.                  for(it = NomEst.begin(); it != NomEst.end(); ++it){
  10.                     if((*it) == nombre){      
  11.                        PosNom++;      
  12.                           }
  13.                          } if (PosNom > 0){
  14.                        j++;
  15.                        system ("cls");
  16.                        cout << "\n\nESTE NOMBRE YA EXISTE!!!" << endl;
  17.                        cout << "\n\nFAVOR DIGITAR OTRO NOMBRE DE ESTUDIANTE DIFERENTE\n" << endl;                                          
  18.                        system("pause");
  19.                       }PosNom = 0;
  20.                         NomEst.push_back(nombre);
  21.                        if(j==1){
  22.                           NomEst.erase(it);
  23.                           vector<string>::iterator itTemp = --it;
  24.                           PosNom++;
  25.                        }
  26.                        j=0;
  27.                  system("pause");
  28.                  }


miren la imagen.

7  Programación / Programación C/C++ / Necesito ayuda en este codigo please en: 11 Marzo 2015, 03:54 am
me da este error al ejecutar el programa:
29 C:\Users\JuanaG\Programacion\Estructura de Datos\OtroVectorEstructurado.cpp invalid use of void expression

Código
  1. class cEstudiante{
  2.        private:
  3.             string NomEst;    
  4.        public:
  5.             void setNomEst(string pNomEst){NomEst = pNomEst;}
  6.             string getNomEst(){return NomEst;}  
  7.             vector<string> vEstudiante;
  8.             vector<string>::iterator it;
  9.             void addNomEst(){
  10.                  string nombre;
  11.                  cout<<"Digite el nombre que desea agregar: ";
  12.                  cin >> nombre;
  13.                  for(it = vEstudiante.begin(); it != vEstudiante.end(); it++){
  14.                    vEstudiante.push_back(setNomEst(nombre));
  15.                  }
  16.                  system("pause");
  17.                  }
  18.  
  19.             void showNomEst(){
  20.                  cout<<"Los nombres digitados son: "<<endl;
  21.                  for(it = vEstudiante.begin(); it != vEstudiante.end(); ++it){
  22.                         cout << *it;
  23.                         }
  24.                  cout << endl;
  25.                  system("pause");
  26.                  }
  27.  
  28.      };

ya solucione mi error, tarde pero lo solucione... para cualquier duda:

Código
  1. class cEstudiante{
  2.        private:
  3.             vector<string> NomEst;    
  4.        public:
  5.             //cEstudiante(string nombre): NomEst(nombre){}
  6.             void setNomEst(vector<string> pNomEst){NomEst = pNomEst;}
  7.             vector<string> getNomEst(){return NomEst;}  
  8.             vector<string>::iterator it;
  9.  
  10.             void addNomEst(){
  11.                  system("cls");
  12.                  cout<<"\n\n\t   <<<<<<<<<<<<<<<<<<<<MENU INSERTAR>>>>>>>>>>>>>>>>>>>>>>>\n\n\n";
  13.                  string nombre;
  14.                  cout<<"Digite el nombre que desea agregar: ";
  15.                  fflush(stdin);
  16.                  cin >> nombre;
  17.                  NomEst.push_back(nombre);
  18.                  system("pause");
  19.                  }
  20.  
  21. void showNomEst(){
  22.                  system("cls");
  23.                  cout<<"\n\n\t   <<<<<<<<<<<<<<<<<<<<<MENU LISTAR>>>>>>>>>>>>>>>>>>>>>>>\n\n\n";
  24.                  cout<<"\n\n\t\tLos nombres digitados son: "<<endl<<endl;
  25.                  for(it = NomEst.begin(); it != NomEst.end(); ++it){
  26.                         cout << *it << endl;
  27.                         }
  28.                  cout << endl;
  29.                  system("pause");
  30.                  }
8  Programación / Programación C/C++ / Alguien que me ayude a hacer este codigo mas eficiente en: 9 Marzo 2015, 01:06 am
en un menu para listar, borrar, buscar un nombre en la clase vector:

Código
  1. //
  2. #include <iostream>
  3. #include <string>          
  4. #include <vector>
  5.  
  6. using std::vector;
  7. using std::cout;
  8. using std::cin;
  9. using std::string;
  10. using std::endl;
  11.  
  12. class cEstudiante{
  13.        public:
  14.             string nomv;
  15.             cEstudiante(string vnomv) : nomv(vnomv){}//constructor
  16.      };
  17.  
  18. main(){
  19.             int run, i, j=0, k=0, cont, con;
  20.             string NomEst, BusNom, PosNom;
  21.             vector<cEstudiante> vEstudiante;
  22.  
  23.             int OpcMen, sigue = 1; //Variables para controlar el menu
  24.             do {
  25.             system("cls");
  26.     system (" color F0");
  27.             cout << "\n\n\t\t<<<<<<<<<<<<<<<<<<<<<<<<MENU>>>>>>>>>>>>>>>>>>>>>>>>>>\n" << endl;
  28.             cout << "\n\n 1 <**> INSERTAR DATOS" << endl;
  29.             cout << " 2 <**> BORRAR DATOS" << endl;
  30.             cout << " 3 <**> MOSTRAR DATOS" << endl;
  31.             cout << " 4 <**> BUSCAR DATOS" << endl;
  32.             cout << " 0 <**> SALIR" << endl << endl;
  33.             cout<<"\n\t   Ingrese su opci\242n: ";
  34.     while(!(std::cin>>OpcMen))
  35.             {
  36.      std::cin.clear();
  37.      std::string error;
  38.      std::cin>>error;
  39.      system("cls");
  40.              cout<<"\n\tLA OPCION INGRESADA NO EXISTE\n";
  41.      cout<<"\n\tIngrese su opci\242n nuevamente: ";
  42.              }
  43.         switch(OpcMen) {
  44.     case 1:
  45.                  system("cls");
  46.                  cout << "\n\nENTRE EL NOMBRE:\n " ;
  47.                  fflush(stdin);
  48.                  getline(cin, NomEst);
  49.                  system("cls");
  50.  
  51.                  do{
  52.                    run = vEstudiante.size();
  53.                    cont=0;                            
  54.                     for (i=0;i<run;i++){      
  55.                        cEstudiante runEstudiante = vEstudiante[i];
  56.                         if(runEstudiante.nomv == NomEst){
  57.                            cont++;
  58.                            }      //I f
  59.                        }      //for
  60.                       if(cont>0){
  61.                        j++;  
  62.                        system ("cls");
  63.                        cout << "\n\nESTE NOMBRE YA EXISTE!!!" << endl;
  64.                        cout << "\n\nFAVOR DIGITAR OTRO NOMBRE DE ESTUDIANTE DIFERENTE\n" << endl;                                          
  65.                        system("pause");
  66.                        system ("cls");
  67.                        } cont=0;
  68.                  }while(cont>0);                          
  69.  
  70.                 vEstudiante.push_back(cEstudiante(NomEst));
  71.                 if(j==1) {
  72.                 vEstudiante.erase(vEstudiante.begin()+i);
  73.                  }
  74.                 j=0;                            
  75.                 break;
  76.  
  77.     case 2:
  78.                   system ("cls");
  79.                   cout << "\nAQUIEN DESEA BORRAR :\n ";
  80.                   cin >> PosNom;
  81.                      for (i=0;i<run;i++){      //for inicio
  82.                       cEstudiante runEstudiante = vEstudiante[i];    
  83.                       if(runEstudiante.nomv == PosNom){
  84.                          k++;                    
  85.                          cout << "\n\nEL NOMBRE \n" << PosNom;
  86.                          vEstudiante.erase(vEstudiante.begin()+i);
  87.                  cout << " FUE BORRADO CON EXITO!!!\n" << endl;
  88.                           }                          
  89.                          }  //fin for
  90.                         if(k==0){
  91.                           cout << "\n ESTE NOMBRE NO EXITE  !!!\n" << endl;
  92.                          }
  93.                           k=0;
  94.                           system("pause");  
  95.                           system(" CLS");                            
  96. break;
  97.     case 3:
  98.   system ("cls");
  99.                   run = vEstudiante.size();
  100.                   cout << "\n\nNOMBRE: \n" << endl;
  101.  
  102.                     for (i=0;i<run;i++){
  103.                       cEstudiante PrintEstudiante = vEstudiante[i];
  104.                         cout<<PrintEstudiante.nomv<<"\t "<<endl;
  105.                        }
  106.                         system("pause");  
  107.                         system ("cls");
  108. break;
  109.                 case 4:
  110.                   system("cls");
  111.                   cout<<"\n\nAQUIEN DESEA BUSCAR:  ";
  112.                   fflush(stdin);
  113.                   getline(cin, BusNom);
  114.  
  115.                   run = vEstudiante.size();
  116.                   con=0;
  117.                   system("cls");              
  118.                   for (i=0;i<run;i++){      //inicio for
  119.                     cEstudiante runEstudiante = vEstudiante[i];
  120.                     if(runEstudiante.nomv == BusNom){
  121.                     cout << "\nRESUTADO: \n\n" << endl;
  122.                     cEstudiante PrintEstudiante = vEstudiante[i];
  123.                     cout << "NOMBRE  " << " POSICION\n" << endl;
  124.                     cout <<PrintEstudiante.nomv<<"\t #"<< i+1<< endl<< endl;
  125.                     con++;        
  126.                   system("pause");
  127.                     }
  128.                     }   // fin for
  129.                   system("cls");
  130.                     if(con==0) {
  131.                     cout << "\nESTE NOMBRE NO EXISTE : \n\n" << endl;
  132.                     system("pause");}
  133.                     con=0;  
  134. break;
  135.                 case 0:
  136.  sigue = 0;
  137. break;
  138.                 default:
  139.                            cout<<"\t\tLA OPCION INGRESADA NO EXISTE\n";
  140.                        system("cls");
  141. }
  142. } while(sigue);      
  143. }
  144.  
  145.  

este es mi codigo quiero hacerlo mas eficiente, controlar los nombres en mayusculas y minusculas y todo eso porfa.
9  Programación / Programación C/C++ / Ayuda... Necesito imprimir los caracteres que mas se repiten de una cadena en: 1 Marzo 2015, 21:40 pm
Tengo esta funcion pero no me tira todos los caracteres repetidos
Código
  1. void ImpCaractRepetidos(){
  2.                         int contador=0;
  3.                         int aux=0;
  4.                         char c;
  5.                         for(int i=0; CadCar[i]!='\0';i++){
  6.                           for(int j=1; j<CadCar.length();j++){
  7.                              if(CadCar[i]==CadCar[j]){
  8.                                contador++;
  9.                              }        
  10.                           }
  11.                           if(contador > aux){
  12.                              aux = contador;
  13.                              c = CadCar[i];
  14.                              contador = 0;        
  15.                                       }
  16.                              else
  17.                                   contador = 0;
  18.  
  19.                         }
  20.                         std::cout<<"\nEn el texto hay "<<aux<<" caracteres repetidos\n";
  21.                         std::cout<<" y son "<<c;
  22.                       }
  23.  

Gracias por la ayuda
10  Programación / Programación C/C++ / imprimir una palabra vertical paralela a la otra en: 24 Febrero 2015, 03:34 am
tengo este codigo y quiero imprimir

h        c          e
o        o          s
l         m         t
a        o          a
                     s

Código
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. main(){
  6.       string c="hola como estas";
  7.       getline(cin,c);
  8.       for(int i=0;c[i]!='\0';i++){
  9.               cout<<endl<<c[i];
  10.           if(i==-1 || c[i] == ' ' && c[i+1] != ' '){
  11.             cout<<c[0+2];
  12.             cout<<"\t\t"<<c[i];
  13.            }    
  14.           }
  15.       system("pause");
  16.       }
  17.  
Páginas: [1] 2
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines