#include <iostream>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <string>
#include<fstream>
using namespace std;
int main()
{
int num;
ifstream inFile;
ofstream outFile;
inFile.open ("random.dat");
outFile.open ("randout");
bool seenBefore(int, int *);
int seen[91];
for(int i=0; i<91; i++)
{ // set all bools to false.
seen[i]=false;
}
while ( inFile >> num )
{
outFile << "Your non-repitive #:"<<endl;
}
for (int i = 10; i<101; i++)
{
cout << i << " " << seenBefore(i, seen) << "\n";// 0=not seen before, 1 = seen before.
}
}
bool seenBefore(int num, int *seen)
{
if(seen[num-10])
{
return true;
}
seen[num-10] = true;
return 0;
}
----------------------------------------------------------------------------------
Ok....this is what i kinna figured...so couldn't I just let the program check the inFile(which contains the random #'s already) ?to see how much time they appear? But could I adjust this so that when each # is read from the inFile, print it only if it's not a duplicate of a number already read (and printed)?? Thx for all the assistance.