We are the protectors of the Republic and we will strike down all that oppose it.
 
HomeHQSearchRegisterLog in
Game Release December 20, 2011. Be Ready
All Returning Inactive Members Please Visit The Cantina.
Search
 
 

Display results as :
 
Rechercher Advanced Search
Latest topics
» Marvel Comics - The Venom Collection
Thu Dec 19, 2013 2:14 am by 

» Electrical Machines II
Thu Dec 19, 2013 1:54 am by 

» The Dinosaur Project (2012) BDRip XviD AC3 HQ Hive-CM8
Thu Dec 19, 2013 1:42 am by 

» Conway DJ Dancing With Dragons
Tue Dec 17, 2013 7:49 am by graypas

» Hindi Video Song [HD]
Tue Dec 17, 2013 7:16 am by graypas

» Internet Boost
Tue Dec 17, 2013 6:16 am by graypas

» gamereasy.com
Sat Nov 30, 2013 6:01 am by gamereasy

» THIS FORUM IS DEAD
Wed Nov 06, 2013 8:02 pm by Bejo Keikodi

» Please Post Applications here
Sun Mar 03, 2013 4:19 pm by Sytarth

Poll

Share | 
 

 Powerball Lottery | PROGRAM |

View previous topic View next topic Go down 
AuthorMessage
TestyVenom90
FORUM GOD
FORUM GOD
avatar

Posts : 654
Reputation : 51
Join date : 2009-07-12

PostSubject: Powerball Lottery | PROGRAM |   Thu May 26, 2011 1:06 pm

Code:
/*
 * File:  Main.cpp
 * Author: TestyVenom
 *
 * Created on September 5, 2011, 10:25 PM
 */

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
#include <time.h>
using namespace std;



const int ARRAY_SIZE = 3000;

int main()
{
   ifstream infile; //file input
        ofstream outfile;
   string filename = "Powerball_lottery.txt"; //name of txt file to be opened
   int total_combos_used;
   int total_not_used;
   int total_plays = 0;
   string date;
   string WB1, WB2, WB3, WB4, WB5, PB, PP;
   

   infile.open(filename.c_str());
   infile >> date >> WB1 >> WB2 >> WB3 >> WB4 >> WB5 >> PB >> PP;

   if(infile) //begin counting plays
   {
      total_plays++;

      while(infile) //loop to count total plays
      {
         total_plays++;
         infile >> date >> WB1 >> WB2 >> WB3 >> WB4 >> WB5 >> PB >> PP;
      }
   }
   infile.close(); //close input file
   cout << "Total number of plays: " << total_plays << endl;

   string played_combos[ARRAY_SIZE] = {"a"}; //array that stores played winning combos

   infile.open(filename.c_str());
   infile >> date >> WB1 >> WB2 >> WB3 >> WB4 >> WB5 >> PB >> PP;

   int i=0; //array position counter
   string combo;
       
   if(infile)
   {
      while(infile)
      {
         combo = (WB1+WB2+WB3+WB4+WB5+PB); //concatenate separated numbers into one value
         played_combos[i] = (combo);
         //cout << combo << endl; //used for testing
         infile >> date >> WB1 >> WB2 >> WB3 >> WB4 >> WB5 >> PB >> PP;
         i++;
      }
   }
   infile.close(); //close input file

       
        //begin random number generator section
        int number_of_tickets = 1; //default number of tickets is one
        int RB1, RB2, RB3, RB4, RB5, RPB; //variables for random numbers
        string random_num, B1, B2, B3, B4, B5, NPB;//numbers are to be changed to strings
       
        /*Initialize random seed*/
        srand( time(NULL) );
       
        cout << "How many tickets do you want generated? ";
        cin >> number_of_tickets;
       
        /*Begin generating random numbers*/
        while (number_of_tickets > 0)
        {
            number_of_tickets = number_of_tickets -1;
        RB1 = rand() % 59 + 1; //ball 1
        RB2 = rand() % 59 + 1; //ball 2
        while (RB2 == RB1)
        {
            RB2 = rand() % 59 + 1;
        }
        RB3 = rand() % 59 + 1; //ball 3
        if (RB3 == RB2 || RB3 == RB1)
        {
            while (RB3 == RB2 || RB3 == RB1)
            {
                        RB3 = rand() % 59 + 1;
            }
        }
        RB4 = rand() % 59 + 1; //ball 4
        if (RB4 == RB3 || RB4 == RB2 || RB4 == RB1)
        {
            while (RB4 == RB3 || RB4 == RB2 || RB4 == RB1)
            {
                RB4 = rand() % 59 + 1;
            }
        }
        RB5 = rand() % 59 + 1; //ball 5
        if (RB5 == RB4 || RB5 == RB3 || RB5 == RB2 || RB5 == RB1)
        {
            while (RB5 == RB4 || RB5 == RB3 || RB5 == RB2 || RB5 == RB1)
            {
                RB5 = rand() % 59 + 1;
            }
        }
       
        RPB = rand() % 39 + 1;
       
       
        outfile.open("new_numbers.txt");
        outfile << RB1 << ' ' << RB2 << ' ' << RB3 << ' ' << RB4 << ' ' << RB5 << ' ' << RPB << endl;
        outfile.close();
        infile.open("new_numbers.txt");
        infile >> B1 >> B2 >> B3 >> B4 >> B5 >> NPB;
        infile.close();
       
       
        if (B1.length() == 1 || B2.length() == 1 || B3.length() == 1 || B4.length() == 1 || B5.length() == 1 || NPB.length() == 1)
        {
            if(B1.length() == 1)
            {
                B1 = '0' + B1;
            }
           
            if(B2.length() == 1)
            {
                B2 = '0' + B2;
            }
           
            if(B3.length() == 1)
            {
                B3 = '0' + B3;
            }
           
            if(B4.length() == 1)
            {
                B4 = '0' + B4;
            }
           
            if(B5.length() == 1)
            {
                B5 = '0' + B5;
            }
           
            if(NPB.length() == 1)
            {
                NPB = '0' + NPB;
            }
        }
       
       
        random_num = B1+B2+B3+B4+B5+NPB;
       
       
       
        cout << "Random number " << RB1<<' ' << RB2<<' ' << RB3<<' ' << RB4<<' ' << RB5<<' ' << RPB << endl;
        cout <<' ' << random_num << endl;
       
        //end random number generator
       
            string num = "320923454031"; //use to force a match for testing
            int ctr = 0; //loop counter
            int no_matches = 0; //number of non-matches
            int matches = 0; //number of matches
            while(random_num != played_combos[ctr] && ctr != total_plays)
            {
               
                if(random_num != played_combos[ctr])
                {
                  no_matches++;
                  ctr++;
                }
                if(random_num == played_combos[ctr])
                {
                    matches++;
                    cout << played_combos[ctr] << " matches " << matches << endl;
                    ctr++;
                }
               
            }
        cout << no_matches << " didn't match" << endl;
        }
       
   return 0;
}

_________________
Lt. Colonel Bisles Runningsun
(a.k.a.TestyVenom90)
Grand Army of the Republic
513th Shock Troopers Battalion


Last edited by TestyVenom90 on Tue Sep 06, 2011 2:49 pm; edited 4 times in total
Back to top Go down
TestyVenom90
FORUM GOD
FORUM GOD
avatar

Posts : 654
Reputation : 51
Join date : 2009-07-12

PostSubject: Re: Powerball Lottery | PROGRAM |   Thu May 26, 2011 1:09 pm

This is what I have so far. There are errors in it. It is very far from complete. I'm just being lazy about it right now. There will be many changes made to it.

_________________
Lt. Colonel Bisles Runningsun
(a.k.a.TestyVenom90)
Grand Army of the Republic
513th Shock Troopers Battalion
Back to top Go down
Tacodude
POINTMAN
POINTMAN
avatar

Posts : 444
Reputation : 9
Join date : 2010-05-08
Age : 22
Location : In a very dark cave.....

PostSubject: Re: Powerball Lottery | PROGRAM |   Thu May 26, 2011 8:12 pm

What is this for? are you trying to win the lottery?
Back to top Go down
TestyVenom90
FORUM GOD
FORUM GOD
avatar

Posts : 654
Reputation : 51
Join date : 2009-07-12

PostSubject: Re: Powerball Lottery | PROGRAM |   Tue Sep 06, 2011 9:12 am

Tacodude wrote:
What is this for? are you trying to win the lottery?

Perhaps...
I have updated the program; I'm back on the job and I think I know how to make this work. It won't be the most efficient or robust program by any means, but that's ok; I'm just making this program for the hell of it. Maybe I can sell this for some cash. If I am able to sell this as my own program for computers and mobile devices, I will give a few of you guys the program for free. I still need to add extra features and finish the original main feature (make it produce a number combo that has not yet won and tell me if there are any repeat winners). It would be great if I could win the lottery through this program because I really need the money (I've "dicked" around way too much in college and I'll be here an extra year or two at this rate).

What this program will do:

Primary:

1) Read in [from a .txt file] all of the winning number combos. since [sometime in] 2001.
2) Check those winning numbers with each other to see if there are any repeats. Then, list the repeats and how many times they are repeated, if any.
3) Generate [however many combos. are specified by the user] random number combos. that do not match any of the winning combos used already (the new number combos. will never have been drawn).

Secondary:

4) Tell how many winning combos. used [this many] odd numbers and [this many] even numbers. This is excluding the Powerball. The Powerball will be calculated separately. (perhaps an option to combine the statistics will be added later)
5) Tell how many odd numbers were in winning combos. and how many even numbers were in winning combos.. This is excluding the Powerball. The Powerball will be calculated separately. (perhaps an option to combine the statistics will be added later)
6) Tell how many times each specific number (i.e. 1, 53, 40, 36, etc.) were part of winning draws. This is excluding the Powerball. The Powerball will be calculated separately. (perhaps an option to combine the statistics will be added later)
7) Tell whether each number was usually part of a predominantly odd combo. or even combo. and how many times for each. This is excluding the Powerball. The Powerball will be calculated separately. (perhaps an option to combine the statistics will be added later)
8) User is able to specify if he wants the new randomly-generated number to be mostly odd or even numbers. This function does not apply to the Powerball.
9) The user can specify the range of each value per ball to be generated after specifying function (8). The range can either be numerical, or "Low" or "High." "High" would be from 30-58 and "Low" is 1-29 for the regular white balls. For the Powerball, "High" would be 20-38 and "Low" would be 1-19. Function (8) does not apply to the Powerball.
10) User can choose the Powerball to be even or odd. Function (9) may be applied if desired.

_________________
Lt. Colonel Bisles Runningsun
(a.k.a.TestyVenom90)
Grand Army of the Republic
513th Shock Troopers Battalion


Last edited by TestyVenom90 on Tue Sep 06, 2011 10:15 am; edited 1 time in total
Back to top Go down
TestyVenom90
FORUM GOD
FORUM GOD
avatar

Posts : 654
Reputation : 51
Join date : 2009-07-12

PostSubject: Re: Powerball Lottery | PROGRAM |   Tue Sep 06, 2011 9:21 am

The "........" are not part of the program. I just put those in for organization of the program because this stupid forum does not recognize multiple spaces in a row as punctuation or whatever. :/

EDIT: I figured out how to make it keep the code formatting.

_________________
Lt. Colonel Bisles Runningsun
(a.k.a.TestyVenom90)
Grand Army of the Republic
513th Shock Troopers Battalion


Last edited by TestyVenom90 on Tue Sep 06, 2011 2:50 pm; edited 1 time in total
Back to top Go down
TestyVenom90
FORUM GOD
FORUM GOD
avatar

Posts : 654
Reputation : 51
Join date : 2009-07-12

PostSubject: Re: Powerball Lottery | PROGRAM |   Tue Sep 06, 2011 9:46 am

By the way, if I win the lottery (when the jackpot >= $100 million), with or without the aid of this program, I will be donating money to the guild for any of the following reasons (maybe all, maybe not all):

1) A professional web-designer to make us an official website. ($50,000-$200,000)
2) The upkeep of said website for 1-4 years. (shouldn't be too expensive if we don't pay someone to maintain it and we just pay for the domain name)
3) Ventrilo or whatever VOIP the guild wants (1 or 2 years paid).
4) General Killshaw (SWTOR account) because he is supposedly having a kid, he's a guild leader, and because I like him. (amount undetermined, but less than $1mil)
5) Everyone who joined the guild prior to launch and was active enough (according to me) will receive enough money for one month of SWTOR and perhaps extra cash on the side. If I win more than $100 million in cash (the jackpot would have to be almost $200 million) instantly (not the annuity payment), certain members who have been with us for a long time and who have been active enough (according to me) will receive enough money to buy themselves a very good gaming PC desktop ($900 - $2,000).
6) If I feel that I have enough money, I will see about paying BLUR to make us an official recruitment video. I will have to pay EA and BioWare just to have the rights to do that, though. So, that would probably cost around $1mil for a 2 minute video...
7) All of the guild leaders will receive [undetermined amount].
8) Anyone in the guild who will not be able to play SWTOR because of a bad computer will have monetary priority so that they may play the game with us.
9) I might also pay a graphic artist to make us some cool ads and general art for our guild.
10) If I win before the game comes out and I feel that I have enough money left over, I will see about buying everyone the Collector's Edition of SWTOR.
11) If, after all of that, I feel that I have enough money left, I will buy everyone a copy of Battlefield 3.

Notice: Do not rely on or expect me, or anyone else in the guild, to win the lottery. Also, this program is designed for the Powerball Lottery; it will not work with any other lottery.

*All of this is applicable only to people who have joined the guild prior to Early Game Access / Launch of SWTOR*

_________________
Lt. Colonel Bisles Runningsun
(a.k.a.TestyVenom90)
Grand Army of the Republic
513th Shock Troopers Battalion


Last edited by TestyVenom90 on Tue Sep 06, 2011 10:20 am; edited 1 time in total
Back to top Go down
Rowno
POINTMAN
POINTMAN
avatar

Posts : 265
Reputation : 12
Join date : 2011-07-29
Age : 25
Location : TX

PostSubject: Re: Powerball Lottery | PROGRAM |   Tue Sep 06, 2011 9:56 am

That's very generous of you. I hope you can get the program working like you want it to and are able to benefit from it.
Back to top Go down
TestyVenom90
FORUM GOD
FORUM GOD
avatar

Posts : 654
Reputation : 51
Join date : 2009-07-12

PostSubject: Re: Powerball Lottery | PROGRAM |   Tue Sep 06, 2011 10:19 am

Rowno wrote:
That's very generous of you. I hope you can get the program working like you want it to and are able to benefit from it.

I hope so, too. Hopefully, I can, at the very least, make this do everything I want it to and then be able to use it in an interview for a job. It's not too complicated, I'm just not very experienced and I'm not trying too hard to make it efficient and robust. Still, it would show that I'm willing to go outside of my comfort zone and knowledge to try and improve my skills/knowledge of programming (which is good for an interview for an electrical engineering or computer programming job). If I can get money out of this, it would be a huge bonus.

_________________
Lt. Colonel Bisles Runningsun
(a.k.a.TestyVenom90)
Grand Army of the Republic
513th Shock Troopers Battalion
Back to top Go down
Bejo Keikodi
LEET
LEET
avatar

Posts : 1002
Reputation : 24
Join date : 2010-06-29
Age : 21
Location : New Jersey

PostSubject: Re: Powerball Lottery | PROGRAM |   Tue Sep 06, 2011 10:40 am

wow testy that is really very generous and kind of you,
Back to top Go down
Rowno
POINTMAN
POINTMAN
avatar

Posts : 265
Reputation : 12
Join date : 2011-07-29
Age : 25
Location : TX

PostSubject: Re: Powerball Lottery | PROGRAM |   Tue Sep 06, 2011 11:14 am

Also if everything does pull through and go according to plan, I suggest a copy write of the guilds name that way we don't have to deal with mock guilds. Such as the one on the swtor forums that gave us some issues.
Back to top Go down
TestyVenom90
FORUM GOD
FORUM GOD
avatar

Posts : 654
Reputation : 51
Join date : 2009-07-12

PostSubject: Re: Powerball Lottery | PROGRAM |   Tue Sep 06, 2011 1:25 pm

Rowno wrote:
Also if everything does pull through and go according to plan, I suggest a copy write of the guilds name that way we don't have to deal with mock guilds. Such as the one on the swtor forums that gave us some issues.

-- I don't think we can do that because there really was a "Grand Army of the Republic." Even if we can, I don't think we should. It's just a hassle to do that. I would consider it, though. It probably wouldn't be needed because if we have an awesome video made by Blur and an awesome website, everyone would either just join us or ally with us, or it would be very obvious who the real Grand Army was.

-- Also, if everyone has the Collector's Edition, or even the Digital Deluxe Edition, and we are active enough, I'm pretty sure we'd draw some attention in-game. I won't be able to play very much, but if our members that are on frequently are able to make a name for themselves and our guild, then we'd probably end up being sponsored just to play the game if we had all that other stuff, too. That would be pretty cool, in a way.

_________________
Lt. Colonel Bisles Runningsun
(a.k.a.TestyVenom90)
Grand Army of the Republic
513th Shock Troopers Battalion
Back to top Go down
Rowno
POINTMAN
POINTMAN
avatar

Posts : 265
Reputation : 12
Join date : 2011-07-29
Age : 25
Location : TX

PostSubject: Re: Powerball Lottery | PROGRAM |   Tue Sep 06, 2011 3:16 pm

TestyVenom90 wrote:
Rowno wrote:
Also if everything does pull through and go according to plan, I suggest a copy write of the guilds name that way we don't have to deal with mock guilds. Such as the one on the swtor forums that gave us some issues.

-- I don't think we can do that because there really was a "Grand Army of the Republic." Even if we can, I don't think we should. It's just a hassle to do that. I would consider it, though. It probably wouldn't be needed because if we have an awesome video made by Blur and an awesome website, everyone would either just join us or ally with us, or it would be very obvious who the real Grand Army was.

-- Also, if everyone has the Collector's Edition, or even the Digital Deluxe Edition, and we are active enough, I'm pretty sure we'd draw some attention in-game. I won't be able to play very much, but if our members that are on frequently are able to make a name for themselves and our guild, then we'd probably end up being sponsored just to play the game if we had all that other stuff, too. That would be pretty cool, in a way.


Yeah I didn't take that all into account at the time but like I said it was just a suggestion.
Back to top Go down
Sponsored content




PostSubject: Re: Powerball Lottery | PROGRAM |   

Back to top Go down
 
Powerball Lottery | PROGRAM |
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» example of Basic turbo C program in PLC Programming
» "Refer a Friend" program on Taiwan Servers?
» DeAveiro Basketball Skills Development Program
» Jester java chess program
» New user (I can program in c++)

Permissions in this forum:You cannot reply to topics in this forum
The Grand Army of the Republic :: Guild Records :: Guild Records-
Jump to: