VECTOR CON DATOS ALEATORIOS SIN REPETIR
#include <cstdlib>
#include <ctime>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <cstdlib>
#include <string>
#include <algorithm>
using namespace std;
int main(){
/*------------------------------------------------------------------
int posiciones[100];
string letras [10][10] = {{"LUN"}, {"MAR"}, {"MIE"}, {"JUE"},{"VIE"},{"SAB"},{"DOM"},{"↑↓→←"},{"∟↔▲▼ !"}};
for(int ii = 0; ii < 3; ii++)
{
for(int jj = 0; jj < 3; jj++)
cout<<"\t"<<letras [ii][jj];
cout<<"\n";
}
--------------------------------------- */
//--------------------------------------
/*int posiciones[100];
string letras [10][10] = {{"↓↑↨"}, {"CCC"}, {"FFFF"}, {"NNNNN"}};
random_shuffle(posiciones, posiciones + 100);
for(int fila = 0; fila < 10; fila++){
for(int columna = 0; columna < 10; columna++)
letras [fila][columna] = posiciones[100];
}
for(int f = 0; f < 10; f++){
for(int c = 0; c < 10; c++)
cout << letras[f][c];
cout<<"\n";
cout << endl;
}
//----------- ----------------------------------
*/
//-----------------------------
/* generar letras aleatorios
#include<stdlib.h>
#include<time.h>
#include<stdio.h>
int main(int c, char** s){
int i;
srand(time(NULL));
for(i = 0; i < 100; i++){
printf("La letra es: '%c'n", 'a' + rand() % (('z' - 'a') + 1));
}
return 0;
}
-----------------------------
--------------------------------------------------
/*char strrnd[10];
srand(time(NULL));
for(int l=0; l <= 9; l++)
strrnd[l] = 33 + rand() % (126 - 33);
//strrnd[l] = 50 + rand() % (1000 - 800);
cout << strrnd;
cin.get();
--------------------------------------------------------
*/
cout<<"\n";
int arreglo[100];
int aux = 0;
srand(time(0));
float dias;
float promedio;
float s;
s=0;
dias=3;
cout<<"DIA RESULTADOS";
for(int i = 0; i < dias; i++){
aux = (1 + rand() % 15);
int aux2 = 0;
while(aux2 < i){
if(aux != arreglo[aux2])
aux2++;
else{
aux = (1 + rand() % 15);
aux2 = 0;
}
}
arreglo[i] = aux;
//alt 22 ▬
//→ 26
int g;
cout<<"\n";
s=s+arreglo[i];
cout <<i+1;
cout<<"\t";
for (g=0; g<=arreglo[i]-1; g++)
cout<<"▬";
cout << arreglo[i];
}
cout<<"\n\n\n\tTotal Promedio";
promedio=s/dias;
cout<<"\n\t"<<s<<"\t"<<promedio;
return 0;
}
No hay comentarios:
Publicar un comentario