cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Random Group Maker
Random Group Maker
Feb 24, 2012 at 3:22am UTC
rasen58
(11)
I just started learning about arrays and decided to make a random group generator for school. This is what I have so far
#include <iostream>
#include <string>
#include <stdlib.h>
#include <time.h>
using namespace std;
void main()
{
string name[24];
name[0] = "";
name[1]="";
name[2]="";
name[3]="";
name[4]="";
name[5]="";
name[6]="";
name[7]="";
name[8]="";
name[9]="";
name[10]="";
name[11]="";
name[12]="";
name[13]="";
name[14]="";
name[15]="";
name[16]="";
name[17]="";
name[18]="";
name[19]="";
name[20]="";
name[21]="";
name[22]="";
name[23]="";
srand(24);
int i=0;
while (i <= 24)
{
cout << name[rand()] << endl;
if (i%4==0)
cout << endl;
i++;
}
system("pause");
}[/code]
Last edited on
Feb 24, 2012 at 3:23am UTC
Topic archived. No new replies allowed.