This program is to generate numbers between 0 - 2^32, and I am trying to copy this randomly generated sample into a file, but it gives output as a string of multiple "equal signs(=)'. I don't understand where the error can be from. I also attached an image of the output
#include<iostream>
#include<conio.h>
#include <ctime>
#include<fstream>
#include <cstdlib>
#include <iomanip>
#include <math.h>
#include <vector>
#include <random>
#include <string>
using namespace std;
int main(){
int ya;
vector<unsigned long long> instance;
fstream inFile;
inFile.open("outputFile.txt");
if (!inFile) {
cout << "The file can't be opened" << endl;
}
std::mt19937_64 generator;
generator.seed(std::time(0));
uniform_int_distribution<unsigned long long>randomNumber(0, 4294967295);
for (int index = 0; index < 10; index++) {
cout << randomNumber(generator) << endl;
inFile << randomNumber(generator)<<"\n";
//instance.push_back(randomNumber(generator));
}
if (inFile.is_open()) {
cout << inFile.rdbuf();
}
return 0;
}
Aucun commentaire:
Enregistrer un commentaire