OPERADORES Y NOTACIONES EN C++
AYUDEME POR FAVOR ES PARA ESTE JUEVES 30/02/06
ES UN PROGRAMA EN C++ QUE HAGA LA SIMULACION DEL JUEGO DE LA LOTO HACIENDO 40 COMBINACIONES POSIBLES SIN REPETIR UN NUMERO SELECCIONANDO 6 NUMEROS EN EL MENOR TIRMPO AYUDENME PORFAVOR SI NECESISTO DE SU AYUDA
ES UN PROGRAMA EN C++ QUE HAGA LA SIMULACION DEL JUEGO DE LA LOTO HACIENDO 40 COMBINACIONES POSIBLES SIN REPETIR UN NUMERO SELECCIONANDO 6 NUMEROS EN EL MENOR TIRMPO AYUDENME PORFAVOR SI NECESISTO DE SU AYUDA
Espera con paciencia, el proximo jueves 30 de febrero te mando la respuesta ! ! !
No se si esto es lo que necasitas, pero es lo que mas o menos consegui entender :
// program sorteo.cpp
// written in borland c++, ver 4.52
// 28/2/2006
#include <iostream.h>
#include <iomanip.h>
#include <stdlib.h>
const int N = 40;
void Init(int *a)
{
for(int i = 0;i < N;i++)
a[i] = i + 1;
} // INIT
void Sorteo(int *a)
{
randomize();
for(int i = N-1, j = 0;i >= 0 && j < 6;i--,j++)
{
int k = random(i);
cout << setw(5) << a[k];
for(int j = k;j < N-1;j++)
a[j] = a[j+1];
}
cout << endl << endl;
} // SORTEO
int main()
{
int a[N];
Init(a);
cout << "programa que sortea 6 numeros distintos de 40 numeros dados : "
<< endl << endl;
Sorteo(a);
cout << "end of program - good bye ! ! ! " << endl;
return 0;
} // MAIN
// program sorteo.cpp
// written in borland c++, ver 4.52
// 28/2/2006
#include <iostream.h>
#include <iomanip.h>
#include <stdlib.h>
const int N = 40;
void Init(int *a)
{
for(int i = 0;i < N;i++)
a[i] = i + 1;
} // INIT
void Sorteo(int *a)
{
randomize();
for(int i = N-1, j = 0;i >= 0 && j < 6;i--,j++)
{
int k = random(i);
cout << setw(5) << a[k];
for(int j = k;j < N-1;j++)
a[j] = a[j+1];
}
cout << endl << endl;
} // SORTEO
int main()
{
int a[N];
Init(a);
cout << "programa que sortea 6 numeros distintos de 40 numeros dados : "
<< endl << endl;
Sorteo(a);
cout << "end of program - good bye ! ! ! " << endl;
return 0;
} // MAIN
