How Do I Read a File to a Program?
I tried to search Google, and found absolutely nothing simple that could help. Basically, what I need to do is make filter options for a program. I have no idea how to do this at all. The program I have is this:
Code:
#include <ctime>
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int arrayname[10], q = 0;
while (q < 10) //assign each element of arrayname[] to a random integer from 1 to 10
{
arrayname[q] = rand()%10;
q++;
}
q = 0;
while (q < 10) //cout every element of arrayname on its own line
{
cout << arrayname[q]
q++
}
What I want to be able to do is make it so that, from an external file, you can set numbers that cannot be chosen. So, you can go into a separate file, and choose that you don't want the random generator to ever get the numbers 4 or 7, or something like that. I just need to be able to filter it using an external file. How do I do it? Can someone tell me, or just link me to a tutorial?
Sorry for wasting your time. =[