Ok, Im helping out my local lan gaming center and i'm trying to make a random number generator to place people onto different stations. There are 12 stations and here is the layout
12
11
10
9
8
7
6
5
4
3
2
1
Each person is already assigned a number and we want the program to spit out in order what station they will be at.
// This program uses the random number generator to show
// a listing of random numbers on the screen
// Written by Janine Bouyssounouse on 10/15/08
#include <iostream>
#include <stdlib.h>
#include <ctime>
#include <time.h>
using namespace std;
void welcome();
int randomNumber();
void displayRandom(int number);
int main(int argc, char *argv[])
{
int x;
int spot1;
int spot2;
int spot3;
int spot4;
int spot5;
int spot6;
int spot7;
int spot8;
int spot9;
int spot10;
int spot11;
int spot12;
time_t seconds;
time(&seconds);
srand((unsigned int) seconds);
spot1=rand()%(12-1+1)+1;
cout<<"number 1 goes to " <<spot1;
cout<<endl;
spot2=rand()%(12-1+1)+1;
cout<<"number 2 goes to " <<spot2;
cout<<endl;
system("PAUSE");
return 0;
}
at the moment thats what i have, it does work to an extent but the numbers repeat and we can't have them repeating. I used to be good at this but i havent written a program in over 3 years and am just starting to try and pick it back up. Any information on how to get all
I was also thinking maybe it would just be easier to make an array then shuffle that and display it. It doesnt need to say player [p] is at station[i]. It just needs to not repeat and display 12 numbers on the screen at one time.
Whatever the easiest way to do it will be best. Thanks