#include <iostream>
#include <time.h>
#include <stdlib.h>
#include "/home/theodore/lotto"
using namespace std;

main ()
{
srand(time(0));
int One, Two, Three, Four, Five;
One = rand() % 35 + 1;
Two = rand() % 35 + 1;
Three = rand() % 35 + 1;
Four = rand() % 35 + 1;
Five = rand() % 35 + 1;
while (One == Two || One == Three || One == Four) {
One = rand() % 35 + 1;
}
while (Two == Three | Two == Four) {
Two = rand() % 35 + 1;
}
while (Three == Four) {
Three = rand() % 35 +1;
}
cout << "Here is your Texas Two Step quick pick: " << One << " " << Two << " " << Three << " " << Four ;
cout <<" (" << Five << ") \n";
cout << Lotto ;
}

// Having a hard time, first semester in programming..
//I don't understand for one, the proper command to read from the "Lotto" file
//Which I am trying to read random lines from, and second, the form in which the lines //should be in that are in the Lotto file
//PLEASE HELP...yes, i'm very new to this..

To read from a file, you might try using std::ifstream
If each item is on it's own line, one method you may try, would be storing each line as a std::string, and place them in an array of std::string. Then use your rand() variables to select an array offset (such as array[rand() % 35 + 1]), at which point you could remove that entry from the array, and reduce the range of your random by 1, you may want to first swap the element you remove with the last element in your array.

Good luck!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.