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

 

 


Tema destacado: Recuerda que debes registrarte en el foro para poder participar (preguntar y responder)


  Mostrar Temas
Páginas: [1] 2 3
1  Programación / Programación C/C++ / ayuda estar bien realizado este taller de listas, pilas y colas. denle una vista en: 4 Diciembre 2016, 22:21 pm
Hola buenas me dejaron este trabajo en la universidad, alguien que sepa del tema me diga si esta bien hecho y si hay lago que mejorar me dice como gracias
adjunto lo que hice y el taller

1.   Elaborar una función que reciba el apuntador al primer nodo de la lista y devuelva el numero e nodos que lo componen

2.   Elaborar una función que reciba un apuntador P que apunta al primer nodo De una lista y un apuntador Q que apunta al primer nodo de una segunda lista. La función debe concatenar las dos listas así: el final de la primera lista debe encadenarse con el comienzo de la segunda lista. Cualquiera de las listas, o las dos, pueden estar vacías.


3.   Elaborar una función que reciba dos apuntadores, el apuntador CAB que apunta al primer nodo de la lista y un apuntador Q que apunta a cualquier nodo de la lista. La lista no se encuentra clasificada ascendente. La función debe romper la lista en dos. La primera lista debe incluir todos los nodos cuya información sea menor a Q -> INFO y la segunda todos los nodos cuya información sea mayor o igual a Q -> INFO

4.   elaborar una función que reciba la dirección de cualquier nodo en una lista. la función debe retirar ese nodo de la lista. ¿cuál no es imposible retirar de la lista?
NOTA:  la función solamente recibe un apuntador.


5.   Elaborar una función que reciba el apuntador al primer nodo de la lista y libere todos los nodos de la lista utilizando para cada uno la instrucción FREE (). Se debe devolver el apuntador recibido con el valor NULL.

6.   elaborar una función que reciba un apuntador al primer nodo de una lista. la función debe invertir la lista. la lista debe ser invertida recorriéndola solamente una vez. al final cada nodo debe apuntar al nodo que antes era su predecesor. la cabeza de la lista debe ser el nodo que al comienzo estaba al final y el nodo que antes era el primero, debe tener el valor NULL. gráficamente seria




7.elaborar una función que reciba un apuntador al primer nodo de una lista y devuelva dos apuntadores. el primer debe apuntar a una lista conformada por los nodos impares e la lista inicial y el segundo debe apuntar a una lista conformada por los dos nodos pares de la lista inicial. al final de la lista inicial debe liberarse de la memoria. por ejemplo, si la lista era:





Código
  1.  
  2. #include <stdio.h>
  3. #include <iostream>
  4. #include <stdlib.h>
  5. #define localizar (struct nodo*) malloc(sizeof(struct nodo));
  6. #define memoria_doble (struct list_doble*) malloc(sizeof(struct list_doble));
  7. using namespace std;
  8.  
  9. struct nodo
  10. {
  11.  int inf;
  12.  struct nodo *sig;
  13. };
  14. struct list_doble
  15. {
  16.  nodo *list;
  17.  struct list_doble *enlace;
  18. };
  19. nodo *lista1 = NULL, *lista2 = NULL;
  20. int n_nodos(nodo *);
  21. //void crear_lista(nodo **);
  22. bool crear_nodo();
  23. nodo *concatenar_lista();
  24. void llenar_listas();
  25. void mostrar_lista(nodo*);
  26. nodo *hacer_nodo();
  27. void lista_rota(nodo *, nodo*);
  28. nodo *buscar_nodo(int);
  29. void retirar_nodo(nodo *);
  30. nodo *liberar_nodos(nodo **);
  31. void invertir_lista(nodo **);
  32. list_doble *doble_puntero(nodo *);
  33. int main()
  34. {
  35.  int opc,num_nodo=0,i=1;
  36.  nodo *ele;
  37.  list_doble *prueba=NULL;
  38.  char enter;
  39.  do
  40.  {
  41.    cout<<"\nMENU LISTAS\n\n"
  42.        <<"1)\n"
  43.        <<"2)Numero de nodos de la lista.\n"
  44.        <<"3)Concatenar listas.\n"
  45.        <<"4)Informacion mayor y menor a un nodo de la lista.\n"
  46.        <<"5)Sacar un nodo de la lista.\n"
  47.        <<"6)Liberar todos los nodos de la lista.\n"
  48.        <<"7)Invertir la lista(en un recorrido).\n"
  49.        <<"8)Nodos pares he impares de la lista.\n"
  50.        <<"9)Llenar lista.\n"
  51.        <<"10)Mostrar lista.\n"
  52.        <<"11)Salir\n"
  53.        <<"opcion: ";
  54.        cin>>opc;
  55.        if(opc != 11)
  56.        {
  57.          system("clear"); //system("cls") para windows
  58.        }
  59.    switch(opc)
  60.    {
  61.      case 1:break;
  62.  
  63.      case 2: cout<<"\nEl numero de nodos de la lista es: "<<n_nodos(lista1)<<endl;
  64.              break;
  65.  
  66.      case 3: llenar_listas();
  67.              break;
  68.      case 4: mostrar_lista(lista1);
  69.              cout<<"\nIngresa el numero de un nodo a buscar: ";
  70.              cin>>num_nodo;
  71.              ele = buscar_nodo(num_nodo);
  72.              if(ele != NULL)
  73.              {
  74.                cout<<"Lista dividida";
  75.                lista_rota(lista1,ele);
  76.              }else
  77.              {
  78.                cout<<"\nNodo no encontrado."<<endl;
  79.              }
  80.              ele=NULL;
  81.              break;
  82.      case 5: cout<<"Lista de datos: \n";
  83.              mostrar_lista(lista1);
  84.              cout<<"Nodo a retirar: ";
  85.              cin>>num_nodo;
  86.              ele = buscar_nodo(num_nodo);
  87.              if(ele != NULL)
  88.              {
  89.                retirar_nodo(ele);
  90.                cout<<"\nNodo retirado correctamente\n";
  91.  
  92.              }else
  93.              {
  94.                cout<<"\nNodo no encontrado."<<endl;
  95.              }
  96.              ele=NULL;
  97.              break;
  98.      case 6: ele = liberar_nodos(&lista1);
  99.              if(ele == NULL)
  100.              {
  101.                cout<<"\nMemoria liberada.\n";
  102.              }else
  103.              {
  104.                cout<<"\nFallo al liberar memoria\n";
  105.              }
  106.              ele = NULL;
  107.              break;
  108.      case 7: cout<<"\nDatos de lista: \n";
  109.              mostrar_lista(lista1);
  110.              invertir_lista(&lista1);
  111.              cout<<"\nLista invertida: \n";
  112.              mostrar_lista(lista1);
  113.              break;
  114.      case 8: cout<<"\nDatos de lista: \n";
  115.              mostrar_lista(lista1);
  116.              prueba = doble_puntero(lista1);
  117.              while(prueba != NULL)
  118.              {
  119.                if(i % 2 == 1)cout<<"\nDatos pares\n";
  120.                else cout<<"\nDatos impares\n";
  121.                invertir_lista(&prueba->list);
  122.                mostrar_lista(prueba->list);
  123.                prueba = prueba->enlace;
  124.                i++;
  125.              }
  126.                break;
  127.      case 9: lista1 = hacer_nodo();
  128.              break;
  129.      case 10:  mostrar_lista(lista1);
  130.                break;
  131.      case 11:  cout<<"\nGracias por usar saliendo...............\n";
  132.                break;
  133.      default: cout<<"La opcion no esta en el rango."<<endl;
  134.    }
  135.  
  136.  }while(opc != 11);
  137. /*
  138.  
  139.  
  140.  
  141.   8.
  142.  
  143.   lista1 = hacer_nodo();
  144.   mostrar_lista(lista1);
  145.   prueba = doble_puntero(lista1);
  146.   cout<<"\n\n";
  147.   while(prueba != NULL)
  148.   {
  149.     invertir_lista(&prueba->list);
  150.     mostrar_lista(prueba->list);
  151.     prueba = prueba->enlace;
  152.     cout<<"\n";
  153.   }
  154.   */
  155.  
  156.  printf("\n");
  157.  return 0;
  158. }
  159. list_doble *doble_puntero(nodo *lista)
  160. {
  161.  
  162.  nodo *list_impares=NULL,*impAux=NULL, *list_pares=NULL,*parAux=NULL;
  163.  list_doble *list_new=NULL, *aux_new=NULL;
  164.  int i = 1,t=2;
  165.  
  166.  while(lista != NULL)
  167.  {
  168.  
  169.    if(i % 2 == 0)
  170.    {
  171.      parAux = localizar;
  172.      parAux->inf = lista->inf;
  173.      parAux->sig = list_pares;
  174.      list_pares = parAux;
  175.    }else
  176.    {
  177.      impAux = localizar;
  178.      impAux->inf = lista->inf;
  179.      impAux->sig = list_impares;
  180.      list_impares = impAux;
  181.    }
  182.    lista = lista->sig;
  183.    i++;
  184.  
  185.  }
  186.  
  187.  for(int i = 1; i <= t; i++)
  188.  {
  189.  
  190.    aux_new = memoria_doble;
  191.    if(i % 2 == 0)aux_new->list = list_pares;
  192.    else aux_new->list = list_impares;
  193.    aux_new->enlace = list_new;
  194.    list_new = aux_new;
  195.  }
  196.  
  197.  return list_new;
  198. }
  199.  
  200.  
  201. void invertir_lista(nodo **ini)
  202. {
  203.  nodo *sig=NULL,
  204.       *aux2=NULL,
  205.       *aux=NULL;
  206.        aux2=*ini;
  207.  
  208.  do{
  209.    sig = aux2->sig;
  210.  
  211.    aux2->sig = aux;
  212.    aux = aux2;
  213.  
  214.    if(sig != NULL)
  215.    {
  216.      aux2 = sig;
  217.    }else
  218.    {
  219.      *ini = aux2;
  220.    }
  221.  
  222.  }while(*ini != aux2);
  223. }
  224.  
  225. nodo *liberar_nodos(nodo **ini)
  226. {
  227.  
  228.  while(*ini != NULL)
  229.  {
  230.    free(*ini);
  231.    *ini = (*ini)->sig;
  232.  }
  233.  *ini = NULL;
  234.  return *ini;
  235. }
  236. void retirar_nodo(nodo *d_nod)
  237. {
  238.  nodo *aux = NULL, *q = NULL, *r = NULL,*n_despa=NULL;
  239.  bool retirado = false;
  240.  aux = lista1;
  241.  int cont = 1;
  242.  
  243.  while(aux != NULL && retirado == false)
  244.  {
  245.    if(cont == 1 && aux == d_nod)
  246.    {
  247.      r = lista1;
  248.      n_despa = r;
  249.      lista1 = lista1->sig;
  250.      retirado = true;
  251.    }else
  252.    {
  253.        cont = 2;
  254.        q = aux->sig;
  255.        if(q == d_nod)
  256.        {
  257.          aux->sig = q->sig;
  258.          n_despa = q;
  259.          retirado = true;
  260.        }
  261.      }
  262.    aux = aux->sig;
  263.  }
  264. }
  265.  
  266. nodo *buscar_nodo(int x)
  267. {
  268.  nodo *aux = NULL,*EleBus=NULL;
  269.  bool encontrado = false;
  270.  aux = lista1;
  271.  int i = 1;
  272.  while(aux != NULL && encontrado == false)
  273.  {
  274.    if(x == i)
  275.    {
  276.      EleBus = aux;
  277.      encontrado = true;
  278.    }
  279.    aux = aux->sig;
  280.    i = i + 1;
  281.  }
  282. //  if(encontrado) return EleBus;
  283. //  else return EleBus = NULL;
  284.  return EleBus;
  285. }
  286.  
  287. void lista_rota(nodo *cad, nodo *q)
  288. {
  289.  nodo *listaA=NULL,*a=NULL, *listaB=NULL,*b=NULL;
  290.  while(cad != NULL)
  291.  {
  292.    if(cad->inf < q->inf)
  293.    {
  294.      a = localizar;
  295.      a->inf = cad->inf;
  296.      a->sig = listaA;
  297.      listaA = a;
  298.    }
  299.    if(cad->inf >= q->inf && &cad->inf != &q->inf)
  300.    {
  301.      b = localizar;
  302.      b->inf = cad->inf;
  303.      b->sig = listaB;
  304.      listaB = b;
  305.    }
  306.    cad = cad->sig;
  307.  }
  308.  printf("\nLista con los elementos menores a %d \n",q->inf);
  309.  mostrar_lista(listaA);
  310.  printf("\nLista con los elementos mayores o iguales a %d \n",q->inf);
  311.  mostrar_lista(listaB);
  312. }
  313.  
  314. nodo *hacer_nodo()
  315. {
  316.  nodo *p=NULL, *q=NULL;
  317.  //char cr[2];
  318.  
  319.  while(crear_nodo())
  320.  {
  321.    q = (struct nodo*) malloc(sizeof(struct nodo));
  322.    cout<<"valor para el nodo: ";
  323.    cin>>q->inf;
  324.    cin.ignore(256,'\n');
  325.    q->sig = p;
  326.    p = q;
  327.  }
  328.  return p;
  329. }
  330.  
  331. void mostrar_lista(nodo *list)
  332. {
  333.  int i = 1;
  334.  while(list != NULL)
  335.  {
  336.    printf("%d) %d\n",i,list->inf);
  337.    list = list->sig;
  338.    i = i + 1;
  339.  }
  340. }
  341.  
  342.  
  343. void llenar_listas()
  344. {
  345.  nodo *list=NULL;
  346.  printf("\nLista A: \n");
  347.  lista1 = hacer_nodo();
  348.  printf("\nLista B: \n");
  349.  lista2 = hacer_nodo();
  350.  
  351.  printf("Lista A\n");
  352.  mostrar_lista(lista1);
  353.  
  354.  printf("Lista B\n");
  355.  mostrar_lista(lista2);
  356.  
  357.  printf("Lista concatenada: \n");
  358.  list = concatenar_lista();
  359.  
  360.  mostrar_lista(list);
  361. }
  362.  
  363. nodo *concatenar_lista()
  364. {
  365.  
  366.  nodo *eleFin = NULL;
  367.  bool agregado = false;
  368.  nodo *aux = NULL;
  369.  aux = lista1;
  370.  
  371.  if(aux == NULL)
  372.  {
  373.    lista1 = lista2;
  374.  }else
  375.  {
  376.    while(aux != NULL && agregado == false)
  377.    {
  378.        if(aux->sig == NULL)
  379.        {
  380.          aux->sig = lista2;
  381.          agregado = true;
  382.        }
  383.        aux = aux->sig;
  384.    }
  385.  }
  386.  eleFin = lista1;
  387.  return eleFin;
  388. }
  389.  
  390. int n_nodos(nodo *ini)
  391. {
  392.  
  393.  int c_nodos = 0;
  394.  while(ini != NULL)
  395.  {
  396.    c_nodos++;
  397.    ini = ini->sig;
  398.  }
  399.  return c_nodos;
  400. }
  401.  
  402. bool crear_nodo()
  403. {
  404.  char resp;
  405.  cout << "\nDesear crear un nodo? s/n: ";
  406.  cin>>resp;
  407.  if(resp == 's' || resp == 'S')return true;
  408.  else return false;
  409. //  return (resp == 's' || resp == 'S');
  410. }
  411.  
  412.  


MOD: Imagenes adaptadas a lo permitido.
2  Programación / Programación C/C++ / modificar elementos de una lista en: 25 Octubre 2016, 00:35 am
Ola estoy haciendo un menú de opciones para una lista
pero no he podido hacer la parte de modificar
he visto este código pero no es de la forma que debo hacerlo

Código
  1.  
  2. void modificarDato(Numero **primerNumero)
  3. {
  4.    int nuevoDato;
  5.    int posicion = 1;
  6.    mostrarNumeros(*primerNumero);
  7.    cout << "Ingrese Posicion: "; cin >> posicion;
  8.    cout << "Ingrese nuevo numero: "; cin >> nuevoDato;
  9.    //Si esta fuera del rango
  10.    if (posicion < 1 || posicion > cantidad) {cout << "\n\aPosicion Erronea\n\n"; return;}
  11.    Numero *auxiliar;
  12.    auxiliar = *primerNumero;
  13.    int contador = 1;
  14.    //mientras contador sea distinto a la posicion
  15.    while(contador != posicion) {auxiliar = auxiliar->sig; contador++;}
  16.    auxiliar->dato = nuevoDato; //cambiamos el valor
  17.    mostrarNumeros(*primerNumero);
  18. }
  19.  
  20.  



de la forma que esto haciendo mi menú es así
esta es la parte e ingresar un numero al inicio de la fila

Código
  1.  
  2. void insert_ini()
  3. {
  4. int elem = 0;
  5. printf("\nEscriba el elemento: ");
  6. scanf("%d",&elem);
  7. lista = new nodo;
  8. lista->informacion = elem;
  9. lista->siguiente = inicio;
  10. inicio = lista;
  11. printf("\nElemento agregado satisfactoriamente\n");
  12.  
  13. system("pause");
  14. }
  15.  
  16.  


he tratado e modificar el primer código de arriba
para que se parezca al segundo que tengo pero no he podido,
si alguien me hecha una mano en esa parte
3  Programación / Programación C/C++ / [Error] ld returned 1 exit status en mi programa de pilas y colas en: 19 Octubre 2016, 07:38 am
Ola que tal estoy haciendo esto dev c++
pero me sale este error

si alguien me ayuda lo agradeceria

O:\collect2.exe [Error] ld returned 1 exit status


Código
  1.  
  2. #include "stdio.h"
  3. #include "conio.h"
  4. #include "string.h"
  5. #include "windows.h"
  6. #include "stdlib.h"
  7. #include "time.h"
  8. #include "iostream"
  9. #include "stdlib.h"
  10. struct nodo{
  11. int informacion;
  12. struct nodo *siguiente;
  13. };
  14. int menu();
  15. void agregar_nodo();
  16. void listar();
  17. void insertfinal();
  18. nodo *inicio = NULL, *nuevo = NULL, *aux;
  19. main()
  20. {
  21. int opc=0;
  22. while(opc!=8)
  23. {
  24. switch (opc)
  25. {
  26. case 1:
  27. agregar_nodo();
  28. break;
  29.  
  30. case 2:
  31. insertfinal();
  32. break;
  33. case 3:
  34. break;
  35. case 4:
  36. listar();
  37. break;
  38. }
  39. opc=menu();
  40. }
  41. }
  42. int menu()
  43. {
  44. int opc;
  45. printf("\n\n");
  46. printf("1. Agregar elementos al inicio de la lista \n");
  47. printf("2. Agregar elementos al final de la lista \n");
  48. printf("3. Agregar elementos despues de \n");
  49. printf("4. Listar elementos \n");
  50. printf("5. Buscar elementos \n");
  51. printf("6. Eliminar elementos \n");
  52. printf("7. Eliminar lista \n");
  53. printf("8. Fin de la ejecucion \n");
  54. printf("\n\n");
  55. printf("Seleccione una opcion \n");
  56. scanf("%d",&opc);
  57. printf("\n\n");
  58. printf("la opcion elegida es: %d",opc);
  59. printf("\n\n");
  60. return opc;
  61. }
  62. typedef struct nodo *Tlista;
  63. void agregar_nodo()
  64. {
  65. int elem;
  66. printf("ingrese el elemento de la lista \n");
  67. scanf("%d",&elem);
  68. nuevo = new nodo;
  69. nuevo->informacion=elem;
  70. nuevo->siguiente=inicio;
  71. inicio = nuevo;
  72. printf("\n elemento agregado satisfactorimente \n");
  73. }
  74. void listar()
  75. {
  76. aux=inicio;
  77. while(aux!=NULL)
  78. {
  79. printf("\n elemento: %d",aux->informacion);
  80. aux = aux -> siguiente;
  81. }
  82. }
  83. void insertfinal(int elem,nodo *lista)
  84. {
  85. nodo *nuevo, *aux2=lista;
  86. nuevo = new nodo;
  87. nuevo->informacion = elem;
  88. nuevo->siguiente = NULL;
  89. if(aux2 == NULL)
  90. {
  91. lista = nuevo;
  92. }
  93. else
  94. {
  95. while(aux2->siguiente != NULL)
  96. {
  97. aux2 = aux2->siguiente;
  98. }
  99. aux2->siguiente = nuevo;
  100. }
  101. }
  102.  
  103.  
4  Programación / .NET (C#, VB.NET, ASP) / programa de preguntas para dos usuarios en: 15 Octubre 2016, 21:33 pm
una pregunta

tengo que hacer un programa con 6 preguntas cada una de ellas con 4 opciones de respuesta
y con 5 formularios de la siguiente manera

 formulario 1
pide usuario y contraseña

formulario 2
mensaje  nxxxxx
con un boton siguiente

formulario 3 con 3 preguntas
pregunta 1 con RadioButton
pregunta 2 con ComboBox
pregunta 3 con listbox
con un boton siguiente

formulario 4
pregunta 4 con RadioButton
pregunta 5 con listboxBox
pregunta 3 con listbox
con 2 botones

boton 1  debe decir aplicar cuestionario a usuario
boton 2  imprimir resultados

formulario 5
imprime las respuestas de los dos usuarios
ejemplo

usuario 1 .

pregunta 1 buena
pregunta 2 mala
pregunta 3 mala
pregunta 4 buena
pregunta 5 buena
pregunta 6 mala

usuario 2 .

pregunta 1 buena
pregunta 2 buena
pregunta 3 buena
pregunta 4 buena
pregunta 5 mala
pregunta 6 buena

la cosa es la siguiente tengo todo.
pero no he podido es como aplicarle al usuario 2 las preguntas,
sin que las respuestas sean las mismas del usuario 1

lo que he hecho es lo siguiente:

formulario 1
Código
  1.  
  2. Public Class Form1
  3.  
  4.    Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
  5.  
  6.  
  7.    End Sub
  8.  
  9.    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  10.  
  11.        Dim login, login1, password, password1 As Char
  12.  
  13.  
  14.        login = "bernal"
  15.        password = "1234"
  16.        login1 = "meneses"
  17.        password1 = "123"
  18.  
  19.        If TextBox1.Text = "bernal" And TextBox2.Text = "1234" Or TextBox1.Text = "meneses" And TextBox2.Text = "123" Then
  20.            Form2.Show()
  21.            Me.Hide()
  22.            TextBox1.Text = ""
  23.            TextBox2.Text = ""
  24.        Else
  25.            MsgBox(" Usuario o contraseña incorrectos")
  26.            TextBox1.Text = ""
  27.            TextBox2.Text = ""
  28.        End If
  29.  
  30.    End Sub
  31.  
  32.    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  33.  
  34.    End Sub
  35.  
  36.    Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
  37.  
  38.    End Sub
  39. End Class
  40.  
  41.  


formulario 2
Código
  1. ublic Class Form2
  2.  
  3.    Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  4.  
  5.    End Sub
  6.  
  7.    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  8.  
  9.        Form3.Show()
  10.        Me.Hide()
  11.  
  12.    End Sub
  13. End Class
  14.  

formulario 3
Código
  1. Public Class Form3
  2.  
  3.    Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
  4.  
  5.    End Sub
  6.  
  7.    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  8.        Form4.Show()
  9.        Me.Hide()
  10.    End Sub
  11.  
  12.    Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  13.  
  14.    End Sub
  15. End Class
  16.  

formulario 4
Código
  1. Public Class Form4
  2.  
  3.    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  4.        Form5.Show()
  5.        Me.Hide()
  6.    End Sub
  7.  
  8.    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  9.        Button1.Visible = True
  10.  
  11.        ListBox1.Visible = False
  12.  
  13.        ListBox1.Items().Clear()
  14.  
  15.  
  16.  
  17.  
  18.        Form1.Show()
  19.        Me.Hide()
  20.  
  21.    End Sub
  22.  
  23.    Private Sub Form4_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  24.  
  25.    End Sub
  26. End Class
  27.  

formulario 5
Código
  1. Public Class Form5
  2.  
  3.    Private Sub Label7_Click(sender As Object, e As EventArgs) Handles Label7.Click
  4.  
  5.    End Sub
  6.  
  7.    Private Sub Form5_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  8.  
  9.        Dim suma As Double
  10.        suma = 0
  11.  
  12.  
  13.  
  14.  
  15.  
  16.        If Form3.RadioButton2.Checked = True Then
  17.                Label7.Text = "Correcto"
  18.                suma = suma + 0.8
  19.  
  20.            Else
  21.                Label7.Text = "Incorrecto"
  22.            End If
  23.  
  24.            If Form3.ComboBox1.SelectedItem = "Verdadero" Then
  25.                Label8.Text = "correcto"
  26.                suma = suma + 0.8
  27.            Else
  28.                Label8.Text = "Incorrecto"
  29.            End If
  30.  
  31.  
  32.            If Form3.ListBox1.SelectedItem = "Antivirus" Then
  33.                Label9.Text = "correcto"
  34.                suma = suma + 0.8
  35.            Else
  36.                Label9.Text = "Incorrecto"
  37.            End If
  38.  
  39.            If Form4.RadioButton2.Checked = True Then
  40.                Label27.Text = "correcto"
  41.                suma = suma + 0.8
  42.            Else
  43.                Label27.Text = "Incorrecto"
  44.            End If
  45.  
  46.            If Form4.ComboBox1.SelectedItem = "Verdadero" Then
  47.                Label26.Text = "correcto"
  48.                suma = suma + 0.8
  49.            Else
  50.                Label26.Text = "Incorrecto"
  51.            End If
  52.  
  53.            If Form4.ListBox1.SelectedItem = "Virus informatico" Then
  54.                Label25.Text = "correcto"
  55.                suma = suma + 0.8
  56.            Else
  57.                Label25.Text = "Incorrecto"
  58.            End If
  59.  
  60.        Label6.Text = suma
  61.  
  62.  
  63.  
  64.    End Sub
  65. End Class
  66.  

si alguien me hecha una manito en esa parte lo agraddeceria
5  Programación / .NET (C#, VB.NET, ASP) / Pasar información de un combobox a un listbox en: 11 Octubre 2016, 18:54 pm
Disculpen una pregunta

tengo 3 datos en un combobox
1
2
3
y necesito que al darle click en un un botón agregar se me abra un listbox con los mismos datos el combobox
1
2
3
y agregarle mas datos

el combobox lo tengo en formulario1 y el listbox lo tengo en un formulario 2

Código
  1.  
  2. ListBox1.Items.Add(TextBox1.Text)
  3. Form1.ComboBox1.Items.Add(TextBox1.Text)
  4. TextBox1.Text = ""
  5.  
  6.  

la parte de agregar mas datos desde listbox al combobox ya lo tengo, pero no he podido. es pasar la información del combobox al listbox.
si alguien me explica esa parte como se la hace le agradecería
6  Programación / Programación Visual Basic / error en el orden de 4 números al azar de mayor a menor en: 18 Septiembre 2016, 05:40 am
lo que pasa es que tengo que hacer es un formato de votaciones de 4 personas

los votos son de forma aleatoria:

num1 = candato 1

num2 = candato 2

num3 = candato 3

num4 = candato 4


form2 y  pasarlo a form4

ejemplo
los votos así
4
1
8
3
y el programa me muestra esto

4
1
8
3

pero lo correcto seria:
8
4
3
1

tengo este hecho hasta ahora pero tengo errores no se en que parte ayuda urgente

[code=vbnet]

Dim NUM1, NUM2, NUM3, NUM4 As Integer
        Dim MAYOR, MEDIO, MENOR, MEDIO1 As Double
        NUM1 = A1
        NUM2 = A2
        NUM3 = A3
        NUM4 = A4
        If NUM1 = NUM2 And NUM2 = NUM3 And NUM3 = NUM4 And NUM1 = NUM4 Then
            Form4.Label6.Text = "g"
            Form4.Label10.Text = Me.Label10.Text
            Form4.Label7.Text = "g"
            Form4.Label11.Text = Me.Label11.Text
            Form4.Label8.Text = "g"
            Form4.Label12.Text = Me.Label13.Text
            Form4.Label9.Text = "g"
            Form4.Label13.Text = Me.Label14.Text
        Else
            If NUM1 = NUM2 And NUM2 = NUM3 Then
                Form4.Label6.Text = "g"
                Form4.Label10.Text = Me.Label10.Text
                Form4.Label7.Text = "g"
                Form4.Label11.Text = Me.Label11.Text
                Form4.Label8.Text = "g"
                Form4.Label12.Text = Me.Label13.Text
                If NUM2 > NUM4 Then
                    MAYOR = NUM2
                    MENOR = NUM4
                Else
                    MAYOR = NUM4
                    MENOR = NUM2
                End If
             
                Form4.Label6.Text = "g"
                Form4.Label10.Text = Me.Label10.Text
                Form4.Label9.Text = "g"
                Form4.Label13.Text = Me.Label14.Text
            Else
                If NUM1 = NUM2 And NUM2 = NUM4 Then
                    Form4.Label6.Text = "g"
                    Form4.Label10.Text = Me.Label10.Text
                    Form4.Label7.Text = "g"
                    Form4.Label11.Text = Me.Label10.Text
                    Form4.Label9.Text = "g"
                    Form4.Label13.Text = Me.Label11.Text
                    If NUM2 > NUM3 Then
                        MAYOR = NUM2
                        MENOR = NUM3
                    Else
                        MAYOR = NUM3
                        MENOR = NUM2
                    End If
                   
                    Form4.Label6.Text = "g"
                    Form4.Label10.Text = Me.Label10.Text
                    Form4.Label9.Text = "g"
                    Form4.Label13.Text = Me.Label11.Text
                Else
                    If NUM1 = NUM3 And NUM3 = NUM4 Then

                        Form4.Label6.Text = "g"
                        Form4.Label10.Text = Me.Label10.Text
                        Form4.Label8.Text = "g"
                        Form4.Label12.Text = Me.Label11.Text
                        Form4.Label9.Text = "g"
                        Form4.Label13.Text = Me.Label10.Text
                       
                        If NUM1 > NUM2 Then
                            MAYOR = NUM1
                            MENOR = NUM2
                        Else
                            MAYOR = NUM2
                            MENOR = NUM1
                        End If
           
                        Form4.Label6.Text = "g"
                        Form4.Label10.Text = Me.Label10.Text
                        Form4.Label9.Text = "g"
                        Form4.Label13.Text = Me.Label11.Text
                    Else
                        If NUM2 = NUM3 And NUM3 = NUM4 Then
                            'Label10.CAPTION = "SEGUNDO, TERCERO Y CUARTO SON IGUALES"
                            Form4.Label7.Text = "g"
                            Form4.Label11.Text = Me.Label11.Text
                            Form4.Label8.Text = "g"
                            Form4.Label12.Text = Me.Label13.Text
                            Form4.Label9.Text = "g"
                            Form4.Label13.Text = Me.Label14.Text
                       
                            If NUM1 > NUM2 Then
                                MAYOR = NUM1
                                MENOR = NUM2
                            Else
                                MAYOR = NUM2
                                MENOR = NUM1
                            End If
                            'Label5.CAPTION = "NUMERO MAYOR: " & MAYOR
                            'Label6.CAPTION = "NUMERO MENOR: " & MENOR
                            Form4.Label6.Text = "g"
                            Form4.Label10.Text = Me.Label10.Text
                            Form4.Label9.Text = "g"
                            Form4.Label13.Text = Me.Label14.Text
                        Else
                            If NUM1 = NUM2 And NUM3 <> NUM4 Then
                                ' Label10.CAPTION = "PRIMERO Y EL SEGUNDO SON IGUALES"
                                Form4.Label6.Text = "g"
                                Form4.Label10.Text = Me.Label10.Text
                                Form4.Label7.Text = "g"
                                Form4.Label11.Text = Me.Label11.Text
                                If NUM1 > NUM3 And NUM1 > NUM4 Then
                                    MAYOR = NUM1
                                    If NUM3 > NUM4 Then
                                        MEDIO = NUM3
                                        MENOR = NUM4
                                    Else
                                        MEDIO = NUM4
                                        MENOR = NUM3
                                    End If
                                End If
                                'Label5.CAPTION = "NUMERO MAYOR: " & MAYOR
                                'Label6.CAPTION = "NUMERO MEDIO: " & MEDIO
                                'Label7.CAPTION = "NUMERO MENOR: " & MENOR
                                Form4.Label6.Text = "g"
                                Form4.Label10.Text = Me.Label10.Text
                                Form4.Label8.Text = "g"
                                Form4.Label12.Text = Me.Label11.Text
                                Form4.Label9.Text = "g"
                                Form4.Label13.Text = Me.Label14.Text
                       
                            Else
                                If NUM1 = NUM3 And NUM2 <> NUM4 Then
                                    ' Label10.CAPTION = "PRIMERO Y EL TERCERO SON IGUALES"
                                    Form4.Label6.Text = "g"
                                    Form4.Label10.Text = Me.Label10.Text
                                    Form4.Label8.Text = "g"
                                    Form4.Label12.Text = Me.Label13.Text


                                    If NUM1 > NUM2 And NUM1 > NUM4 Then
                                        MAYOR = NUM1
                                        If NUM2 > NUM4 Then
                                            MEDIO = NUM2
                                            MENOR = NUM4
                                        Else
                                            MEDIO = NUM4
                                            MENOR = NUM2
                                        End If
                                    End If
                                    'Label5.CAPTION = "NUMERO MAYOR: " & MAYOR
                                    ' Label6.CAPTION = "NUMERO MEDIO: " & MEDIO
                                    ' Label7.CAPTION = "NUMERO MENOR: " & MENOR
                                    Form4.Label6.Text = "g"
                                    Form4.Label10.Text = Me.Label10.Text
                                    Form4.Label7.Text = "g"
                                    Form4.Label11.Text = Me.Label13.Text
                                    Form4.Label9.Text = "g"
                                    Form4.Label13.Text = Me.Label14.Text

                                Else
                                    If NUM1 = NUM4 And NUM2 <> NUM3 Then
                                        'Label10.CAPTION = "PRIMERO Y EL CUARTO SON IGUALES"
                                        Form4.Label6.Text = "g"
                                        Form4.Label10.Text = Me.Label10.Text
                                        Form4.Label9.Text = "g"
                                        Form4.Label13.Text = Me.Label14.Text
                                        If NUM1 > NUM3 And NUM1 > NUM2 Then
                                            MAYOR = NUM1
                                            If NUM3 > NUM2 Then
                                                MEDIO = NUM3
                                                MENOR = NUM2
                                            Else
                                                MEDIO = NUM2
                                                MENOR = NUM3
                                            End If
                                        End If
                                        ' Label5.CAPTION = "NUMERO MAYOR: " & MAYOR
                                        ' Label6.CAPTION = "NUMERO MEDIO: " & MEDIO
                                        ' Label7.CAPTION = "NUMERO MENOR: " & MENOR
                                    Else
                                        If NUM2 = NUM3 And NUM1 <> NUM4 Then
                                            ' Label10.CAPTION = "SEGUNDO Y TERCERO SON IGUALES
                                            Form4.Label7.Text = "g"
                                            Form4.Label11.Text = Me.Label11.Text
                                            Form4.Label8.Text = "g"
                                            Form4.Label12.Text = Me.Label13.Text
                                           
                                           

                                            If NUM2 > NUM1 And NUM2 > NUM4 Then
                                                MAYOR = NUM2
                                                If NUM1 > NUM4 Then
                                                    MEDIO = NUM1
                                                    MENOR = NUM4
                                                Else
                                                    MEDIO = NUM4
                                                    MENOR = NUM1
                                                End If
                                            End If
                                            'Label5.CAPTION = "NUMERO MAYOR: " & MAYOR
                                            'Label6.CAPTION = "NUMERO MEDIO: " & MEDIO
                                            'Label7.CAPTION = "NUMERO MENOR: " & MENOR
                                            Form4.Label6.Text = "g"
                                            Form4.Label10.Text = Me.Label10.Text
                                            Form4.Label8.Text = "g"
                                            Form4.Label12.Text = Me.Label11.Text
                                            Form4.Label9.Text = "g"
                                            Form4.Label13.Text = Me.Label14.Text
                                           
                                        Else
                                            If NUM2 = NUM4 And NUM1 <> NUM3 Then
                                                'Label10.CAPTION = "SEGUNDO Y CUARTO SON IGUALES"

                                                Form4.Label7.Text = "g"
                                                Form4.Label11.Text = Me.Label13.Text
                                                Form4.Label9.Text = "g"
                                                Form4.Label13.Text = Me.Label14.Text
                                                If NUM2 > NUM1 And NUM2 > NUM3 Then
                                                    MAYOR = NUM2
                                                    If NUM1 > NUM3 Then
                                                        MEDIO = NUM1
                                                        MENOR = NUM3
                                                    Else
                                                        MEDIO = NUM3
                                                        MENOR = NUM1
                                                    End If
                                                End If
                                                ' Label5.CAPTION = "NUMERO MAYOR: " & MAYOR
                                                ' Label6.CAPTION = "NUMERO MEDIO: " & MEDIO
                                                '  Label7.CAPTION = "NUMERO MENOR: " & MENOR
                                                Form4.Label6.Text = "g"
                                                Form4.Label10.Text = Me.Label10.Text
                                                Form4.Label7.Text = "g"
                                                Form4.Label11.Text = Me.Label13.Text
                                                Form4.Label9.Text = "g"
                                                Form4.Label13.Text = Me.Label14.Text
                                             
                                            Else
                                                If NUM3 = NUM4 And NUM1 <> NUM2 Then
                                                    'Label10.CAPTION = "TERCERO Y CUARTO SON IGUALES"
                                                    Form4.Label8.Text = "g"
                                                    Form4.Label12.Text = Me.Label13.Text
                                                    Form4.Label9.Text = "g"
                                                    Form4.Label13.Text = Me.Label14.Text
                                                    If NUM3 > NUM1 And NUM3 > NUM2 Then
                                                        MAYOR = NUM3
                                                        If NUM1 > NUM2 Then
                                                            MEDIO = NUM1
                                                            MENOR = NUM2
                                                        Else
                                                            MEDIO = NUM2
                                                            MENOR = NUM1
                                                        End If
                                                    End If
                                                    'Label5.CAPTION = "NUMERO MAYOR: " & MAYOR
                                                    'Label6.CAPTION = "NUMERO MEDIO: " & MEDIO
                                                    'Label7.CAPTION = "NUMERO MENOR: " & MENOR
                                                    Form4.Label6.Text = "g"
                                                    Form4.Label10.Text = Me.Label10.Text
                                                    Form4.Label8.Text = "g"
                                                    Form4.Label12.Text = Me.Label11.Text
                                                    Form4.Label9.Text = "g"
                                                    Form4.Label13.Text = Me.Label14.Text
                                                 


                                                Else
                                                    If NUM1 <> NUM2 And NUM1 <> NUM3 And NUM1 <> NUM4 And NUM2 <> NUM3 And NUM2 <> NUM4 And NUM3 <> NUM4 Then
                                                        ''Label10.CAPTION = " "
                                                        If NUM1 > NUM2 And NUM1 > NUM3 And NUM1 > NUM4 Then
                                                            MAYOR = NUM1
                                                            If NUM2 > NUM3 And NUM2 > NUM4 And NUM3 > NUM4 Then
                                                                MEDIO = NUM2
                                                                MEDIO1 = NUM3
                                                                MENOR = NUM4
                                                            Else
                                                                If NUM2 > NUM3 And NUM2 > NUM4 And NUM4 > NUM3 Then
                                                                    MEDIO = NUM2
                                                                    MEDIO1 = NUM4
                                                                    MENOR = NUM3
                                                                Else
                                                                    If NUM3 > NUM2 And NUM3 > NUM4 And NUM2 > NUM4 Then
                                                                        MEDIO = NUM3
                                                                        MEDIO1 = NUM2
                                                                        MENOR = NUM4
                                                                    Else
                                                                        If NUM3 > NUM2 And NUM3 > NUM4 And NUM4 > NUM2 Then
                                                                            MEDIO = NUM3
                                                                            MEDIO1 = NUM4
                                                                            MENOR = NUM2
                                                                        Else
                                                                            If NUM4 > NUM3 And NUM4 > NUM2 And NUM3 > NUM2 Then
                                                                                MEDIO = NUM4
                                                                                MEDIO1 = NUM3
                                                                                MENOR = NUM2
                                                                            Else
                                                                                MEDIO = NUM4
                                                                                MEDIO1 = NUM2
                                                                                MENOR = NUM3
                                                                            End If
                                                                        End If
                                                                    End If
                                                                End If
                                                            End If

                                                        ElseIf NUM2 > NUM1 And NUM2 > NUM3 And NUM2 > NUM4 Then
                                                            MAYOR = NUM2
                                                            If NUM1 > NUM3 And NUM1 > NUM4 And NUM3 > NUM4 Then
                                                                MEDIO = NUM1
                                                                MEDIO1 = NUM3
                                                                MENOR = NUM4
                                                            Else
                                                                If NUM1 > NUM3 And NUM1 > NUM4 And NUM4 > NUM3 Then
                                                                    MEDIO = NUM1
                                                                    MEDIO1 = NUM4
                                                                    MENOR = NUM3
                                                                Else
                                                                    If NUM3 > NUM1 And NUM3 > NUM4 And NUM1 > NUM4 Then
                                                                        MEDIO = NUM3
                                                                        MEDIO1 = NUM1
                                                                        MENOR = NUM4
                                                                    Else
                                                                        If NUM3 > NUM1 And NUM3 > NUM4 And NUM4 > NUM1 Then
                                                                            MEDIO = NUM3
                                                                            MEDIO1 = NUM4
                                                                            MENOR = NUM1
                                                                        Else
                                                                            If NUM4 > NUM3 And NUM4 > NUM1 And NUM3 > NUM1 Then
                                                                                MEDIO = NUM4
                                                                                MEDIO1 = NUM3
                                                                                MENOR = NUM1
                                                                            Else
                                                                                MEDIO = NUM4
                                                                                MEDIO1 = NUM1
                                                                                MENOR = NUM3
                                                                            End If
                                                                        End If
                                                                    End If
                                                                End If
                                                            End If

                                                        ElseIf NUM3 > NUM1 And NUM3 > NUM2 And NUM3 > NUM4 Then
                                                            MAYOR = NUM3
                                                            If NUM1 > NUM2 And NUM1 > NUM4 And NUM2 > NUM4 Then
                                                                MEDIO = NUM1
                                                                MEDIO1 = NUM2
                                                                MENOR = NUM4
                                                            Else
                                                                If NUM1 > NUM2 And NUM1 > NUM4 And NUM4 > NUM2 Then
                                                                    MEDIO = NUM1
                                                                    MEDIO1 = NUM4
                                                                    MENOR = NUM2
                                                                Else
                                                                    If NUM2 > NUM1 And NUM2 > NUM4 And NUM1 > NUM4 Then
                                                                        MEDIO = NUM2
                                                                        MEDIO1 = NUM1
                                                                        MENOR = NUM4
                                                                    Else
                                                                        If NUM2 > NUM1 And NUM2 > NUM4 And NUM4 > NUM1 Then
                                                                            MEDIO = NUM2
                                                                            MEDIO1 = NUM4
                                                                            MENOR = NUM1
                                                                        Else
                                              &
7  Programación / Programación C/C++ / hacer mas corto el programa y si esta bien hecho en: 15 Septiembre 2016, 21:33 pm
ola buenas alguien que me revise este código y me diga si estas bien hecho y si se puede hacer un poco mas corto

Esto es lo que hace
1.   Cree una 5 funciones, donde cada una reciba en un arreglo de tamaño 100, una cadena de caracteres. Cada función debe retornar:
1.   La longitud de la cadena
2.   El número de vocales
3.   Caracteres alfabéticos en minúsculas
4.   Caracteres alfabéticos en mayúsculas
5.   Caracteres dígitos.

   Ejemplo: Si se leyó la siguiente cadena:
      Todo Lo Que Puedas Imaginar es reaL 2016
   Cada función retornará:
   Longitud:  40
   Vocales: 15
   Minúsculas: 23
   Mayúsculas: 6
   Digitos: 4


Código
  1.  
  2. #include <stdio.h>
  3. #include <conio.h>
  4. #include <string.h>
  5. #include <ctype.h>
  6.  
  7. int contar_vocales(char *);
  8. int mayusculas(char a[]);
  9. int minusculas(char a[]);
  10. int contar_caracteres(char a[]);
  11. int contar_numeros(char a[]);
  12.  
  13. int main()
  14. {
  15. char cad[500],*p;
  16. int longi,x,P,V;
  17. int mini,mayu;
  18.  
  19. printf("Ingrese un texto: ");
  20. gets(cad);
  21. longi = strlen(cad);
  22. //Contador palabras
  23. P=0;
  24.  
  25.  
  26.  
  27.  
  28. mayu= mayusculas(cad);
  29. mini = minusculas(cad);
  30.  
  31. printf("\nCantidad de MAYUSCULAS: %d",mayu);
  32.  
  33. printf("\nCantidad de minusculas: %d",mini);
  34. //vocales y caracteres
  35. printf("\nCantidad de Vocales: %d",contar_vocales(cad));
  36. V = contar_vocales(cad);
  37. printf("\nCantidad de caracteres: %d",contar_caracteres(cad));
  38. printf("\nCantidad de muneros: %d",contar_numeros(cad));
  39.  
  40. }
  41.  
  42. int mayusculas(char a[])//
  43. {
  44. int i;
  45. int contador=0;// CONTADOR DE PALABRAS
  46. int verificador=0;//VERIFICADOR DEL COMIENZO Y FINAL DE CADA PALABRA
  47.  
  48. for (i=0; a[i]!='\0'; i++)
  49. {
  50. if (a[i]>='A' && a[i]<='Z')
  51. {
  52. contador=contador + 1;
  53. }
  54. }
  55. return (contador);
  56. }
  57.  
  58. int minusculas(char a[])//
  59. {
  60. int i;
  61. int contador=0;// CONTADOR DE PALABRAS
  62. int verificador=0;//VERIFICADOR DEL COMIENZO Y FINAL DE CADA PALABRA
  63.  
  64. for (i=0; a[i]!='\0'; i++)
  65. {
  66. if (a[i]>='a' && a[i]<='z')
  67. {
  68. contador=contador + 1;
  69. }
  70. }
  71. return (contador);
  72. }
  73.  
  74. int contar_vocales(char *cad)
  75. {
  76. int cont=0;
  77. char *aux=cad;
  78.  
  79. while(*aux)
  80. {
  81. if(*aux=='a'||*aux=='e'||*aux=='i'||*aux=='o'||*aux=='u'||*aux=='A'||*aux=='E'||*aux=='I'||*aux=='O'||*aux=='U')
  82. cont++;
  83. aux++;              
  84.   }
  85.   return cont;
  86. }
  87.  
  88. int contar_caracteres(char a[])
  89. {
  90. int i;
  91. int contador=0;// CONTADOR DE PALABRAS
  92.  
  93. for (i=0; a[i]!='\0'; i++)
  94. {
  95. contador++;
  96. }
  97. return (contador);
  98. }
  99.  
  100. int contar_numeros(char a[])
  101. {
  102. int i;
  103. int contador=0;// CONTADOR DE PALABRAS
  104.  
  105. for (i=0; a[i]!='\0'; i++)
  106. {
  107. if (a[i]>='1' && a[i]<='9' or a[i]=='0')
  108. {
  109. contador++;
  110. }
  111.  
  112. }
  113. return (contador);
  114. }
  115.  
  116.  

Gracias
8  Programación / Programación Visual Basic / abrir varios formularios desde un solo formulario en: 12 Septiembre 2016, 04:43 am
buenas noches una pregunta



tengo que hacer este  programa que tenga 5 formularios:

1. Se debe Generar el Numero aleatorio del 1 al 25 en cada uno de los tres tableros

2. Se debe Llenar todo el Tablero para ganar

3. Debe haber la opción de manual y automático.

4. En cada tablero se debe llevar las cuentas de buenas y malas.

5 Realizar los 4 formularios pequeños de tal manera que se deben poder ver los 4 a la vez
Formulario 1

6. Desde este formulario se juega se debe poder jugar automático o manual.

tengo lo que me piden en un solo formulario.  los 15 números aleatorios y sin repetirse, el generador de la letra y el numero, el contador de buenas y malas , la parte de forma manual y automático

he visto una orden que es
Dim frm As New Form2()
frm.Show()

me abre los 5 cartones pero no logro. que se me generen los 15 números diferentes en cada cartón y el contador de buenas y malas en cada unos de ellos. y cuando uno de estos se llene me diga ganaste con el cartón ejemplo (cartón numero 2)

si alguien me brinda una ayuda los agradecería
9  Programación / Programación C/C++ / buscador de palabras con un error en: 10 Septiembre 2016, 22:45 pm
Hola alguien me ayude en esta parte que tengo un error
no esta dando correctamente el resultado
ejemplo
ingreso esta frase
ella durmio al calor de las masas y se durmieron todos
y deseo buscar la palabra durmio y deberia mostrarme durmio ha sido encontrado 1 vez
pero me lo indica que esta dos veces
si alguien me ayuda lo agradecería


Código
  1.  
  2. #include "conio.h"
  3. #include "stdio.h"
  4. #include "stdlib.h"
  5. #include "string.h"
  6. #include "windows.h"
  7. #include "iostream"
  8. #include "time.h"
  9. using namespace std;
  10. int contar(char texto[150], char buscar[150])
  11. {
  12. char *puntero;
  13. int contador = 0;
  14. puntero = strstr (texto, buscar);
  15. while (puntero != NULL)
  16. {
  17. contador=contador+1;
  18. puntero = strstr (puntero+strlen(buscar),buscar);
  19. }
  20. return contador;
  21. }
  22. int main()
  23. {
  24. char texto[150];
  25. char palabra[150];
  26. int contadorpalabra = 0;
  27. cout<<"Suministre el texto de entrada:"<<endl;
  28. gets(texto);
  29. cout<<"Suministre la palabra a buscar:"<<endl;
  30. gets(palabra);
  31. contadorpalabra = contar(texto,palabra);
  32. cout<<"\nLa palabra \""<<palabra<<"\" fue encontrada "<<contadorpalabra<<" veces"<<endl;
  33. }
  34.  
10  Programación / Programación Visual Basic / como ocultar números en un juego en: 4 Septiembre 2016, 04:11 am
Buenas estoy haciendo el famoso juego de memoria
con 6 botones
tengo problemas en la parte de ocultar los números y que cuando estos no coincidan se vueltan a tapar
ya tengo la parte que estos solo se repitan 2 veces
1 2 3
3 2 1
es un ejemplo
y otra cosa mas como hago para que estos se roten en los cuadros
solo me logrado que se me cambien en 4 posiciones
si alguien me ayude o me facilite algún código de 6 cuadros para guiarme
Páginas: [1] 2 3
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines