Preciso de ajuda aqui nesse codigo!!! Não estou conseguindo criar uma forma para que se criei automaticamente 500 vetores e tambem ir armazenando esses vetores em arquivos txt
/**************************************************/
/* */
/* */
/* i */
/* */
/* Data: 29/08/19 10:00 */
/* */
/* Descrição: Gerar Numeros Aleatorios sem rep. */
/* */
/**************************************************/
//Bibliotecas
#include <iostream>
#include <time.h>//Biblioteca nescessaria para a função time()
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <string>
using namespace std;
//Assinatura das Funções
bool Existe(int Vetor[],int Tam, int Valor);//Função Existe verefica se um valor já exite no vetor
void Gera_Numero(int Vetor[],int Tam, int Menor, int Maior);
void Gera_Repetido(int Vetor[],int Tam, int Menor, int Maior);
//Função Principal
int main(){
cout<<"GERANDO 5000 VALORES ALETORIOS SEM REPETICAO"<<endl;
int Tam, Nao_Repetidos, Repetidos,Menor, Maior, Valor;
Nao_Repetidos = 4500;
Repetidos = 500;
Menor = 0;
Maior = Nao_Repetidos;
Tam = Nao_Repetidos;
int Vetor[5000];//Declarando o vetor para receber os 5000 valores
Gera_Numero(Vetor,Tam,Menor,Maior);
Vetor[Repetidos];//Declarando o vetor para receber os 5000 valores
Menor = Nao_Repetidos;
Maior = 10;//Define a porcentagem de repetição dos valores
Tam = Repetidos;
Gera_Repetido(Vetor,Tam,Menor,Maior);
return 0;
}
bool Existe(int Vetor[],int Tam, int Valor){
for(int i = 0;i<Tam;i++){
if(Vetor == Valor)
return true;
}
return false;
}
void Gera_Numero(int Vetor[],int Tam, int Menor, int Maior){
fstream arquivo;
ofstream out ("vetor10.txt",ios::app);
int Valor;
srand(time(NULL));//Plantando a semente para função rand()
for(int i=0; i < Tam; i++){
Valor = (Menor + (rand() % Maior));
while(Existe(Vetor,i,Valor)){
Valor = (Menor + (rand() % Maior));
}
Vetor = Valor;
out << Vetor<<endl;
cout<<Vetor<<endl;
arquivo.close();
}
cout<<"Arquivo gerado com sucesso!"<<endl;
}
void Gera_Repetido(int Vetor[],int Tam, int Menor, int Maior){
fstream arquivo;
ofstream out ("vetor10.txt",ios::app);
int Valor;
srand(time(NULL));//Plantando a semente para função rand()
for(int i=0; i < Tam; i++){
Valor = (Menor + (rand() % Maior));
Vetor = Valor;
out << Vetor<<endl;
cout<<Vetor<<endl;
arquivo.close();
}
cout<<"Arquivo gerado com sucesso!"<<endl;
}