Feb 1, 2013 at 4:57am UTC
ok peeps, i am new to all of this, i was writing this program, to generate 5 random numbers, and then use those numbers to chose a spot in an array, and print that block in the array here is what i have, but it does nothing
#include "stdafx.h"
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <time.h>
#include <string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
time_t seconds;
time(&seconds);
srand((unsigned int) seconds);
for (int x = 1; x<1;x++){
int a = rand();
int b = rand();
int c = rand();
int d = rand();
int e = rand();
string pool[445];
pool[0]=1;
pool[1]=1;
pool[3]=1;
pool[4]=1;
pool[5]=1;
pool[6]=1;
pool[7]=1;
pool[8]=1;
pool[9]=1;
pool[10]=1;
pool[11]=1;
pool[12]=2;
pool[13]=2;
pool[14]=2;
pool[15]=3;
pool[16]=3;
pool[17]=3;
pool[18]=3;
pool[19]=3;
pool[20]=3;
pool[21]=3;
pool[22]=3;
pool[23]=3;
pool[24]=3;
pool[25]=3;
pool[26]=4;
pool[27]=4;
pool[28]=4;
pool[29]=4;
pool[30]=4;
pool[31]=4;
pool[32]=4;
pool[33]=4;
pool[34]=4;
pool[35]=5;
pool[36]=5;
pool[37]=5;
pool[38]=5;
pool[39]=5;
pool[40]=5;
pool[41]=5;
pool[42]=5;
pool[43]=5;
pool[44]=5;
pool[45]=5;
pool[46]=5;
pool[47]=6;
pool[48]=6;
pool[49]=6;
pool[50]=6;
pool[51]=6;
pool[52]=6;
pool[53]=6;
pool[54]=6;
pool[55]=7;
pool[56]=7;
pool[57]=7;
pool[58]=7;
pool[59]=7;
pool[60]=7;
pool[61]=7;
pool[62]=7;
pool[63]=7;
pool[64]=7;
pool[65]=7;
pool[66]=7;
pool[67]=8;
pool[68]=8;
pool[69]=8;
pool[70]=8;
pool[71]=8;
pool[72]=8;
pool[73]=8;
pool[74]=8;
pool[75]=8;
pool[76]=8;
pool[77]=8;
pool[78]=8;
pool[79]=8;
pool[80]=9;
pool[81]=9;
pool[82]=9;
pool[83]=9;
pool[84]=9;
pool[85]=9;
pool[86]=10;
pool[87]=10;
pool[88]=10;
pool[89]=10;
pool[90]=10;
pool[91]=10;
pool[92]=10;
pool[93]=10;
pool[94]=10;
pool[95]=10;
pool[96]=11;
pool[97]=11;
pool[98]=11;
pool[99]=11;
pool[100]=11;
pool[101]=11;
pool[102]=11;
pool[103]=11;
pool[104]=11;
pool[105]=11;
pool[106]=11;
pool[107]=11;
pool[108]=12;
pool[109]=12;
pool[110]=12;
pool[111]=12;
pool[112]=12;
pool[113]=13;
pool[114]=13;
pool[115]=13;
pool[116]=13;
pool[117]=13;
pool[118]=13;
pool[119]=13;
pool[120]=13;
pool[121]=13;
pool[122]=13;
pool[123]=14;
pool[124]=14;
pool[125]=14;
pool[126]=14;
pool[127]=14;
pool[128]=14;
pool[129]=14;
pool[130]=14;
pool[131]=14;
pool[132]=14;
pool[133]=14;
pool[134]=14;
pool[135]=14;
pool[136]=15;
pool[137]=15;
pool[138]=15;
pool[139]=15;
pool[140]=15;
pool[141]=15;
pool[142]=15;
pool[143]=15;
pool[144]=15;
pool[145]=16;
pool[146]=16;
pool[147]=16;
pool[148]=16;
pool[149]=16;
pool[150]=16;
pool[151]=16;
pool[152]=16;
pool[153]=16;
pool[154]=16;
pool[155]=17;
pool[156]=17;
pool[157]=17;
pool[158]=17;
pool[159]=17;
pool[160]=17;
pool[161]=17;
pool[162]=17;
pool[163]=17;
pool[164]=18;
pool[165]=18;
pool[166]=18;
pool[167]=18;
pool[168]=18;
pool[169]=18;
pool[170]=18;
pool[171]=18;
pool[172]=19;
pool[173]=19;
pool[174]=19;
pool[175]=19;
pool[176]=19;
pool[177]=19;
pool[178]=19;
pool[179]=19;
pool[180]=20;
pool[181]=20;
pool[182]=20;
pool[183]=20;
pool[184]=20;
pool[185]=20;
pool[186]=20;
pool[187]=20;
pool[188]=20;
pool[189]=20;
pool[190]=20;
pool[191]=20;
pool[192]=20;
pool[193]=21;
pool[194]=21;
pool[195]=21;
pool[196]=21;
pool[197]=21;
pool[198]=21;
pool[199]=22;
pool[100]=22;
pool[101]=22;
pool[102]=22;
pool[103]=22;
pool[104]=22;
pool[105]=22;
pool[106]=22;
pool[107]=23;
pool[108]=23;
pool[109]=23;
pool[110]=23;
pool[111]=23;
pool[112]=23;
pool[113]=23;
pool[114]=23;
pool[115]=23;
pool[116]=23;
pool[117]=23;
pool[118]=23;
pool[119]=23;
pool[120]=23;
pool[121]=24;
pool[122]=24;
pool[123]=24;
pool[124]=24;
pool[125]=24;
pool[126]=24;
pool[127]=24;
pool[128]=24;
pool[129]=25;
pool[130]=25;
pool[131]=25;
pool[132]=25;
pool[133]=26;
pool[134]=26;
pool[135]=26;
pool[136]=26;
pool[137]=26;
pool[138]=26;
pool[139]=26;
pool[140]=26;
pool[141]=26;
pool[142]=26;
pool[143]=26;
pool[144]=26;
pool[145]=27;
pool[146]=27;
pool[147]=27;
pool[148]=27;
pool[149]=27;
pool[150]=27;
pool[151]=28;
pool[152]=28;
pool[153]=28;
pool[154]=28;
pool[155]=28;
pool[156]=28;
pool[157]=28;
pool[158]=28;
pool[159]=28;
pool[160]=28;
pool[161]=28;
pool[162]=29;
pool[163]=29;
pool[164]=29;
pool[165]=29;
pool[166]=29;
pool[167]=29;
pool[168]=29;
pool[169]=29;
pool[170]=29;
pool[171]=29;
pool[172]=29;
pool[173]=29;
pool[174]=29;
pool[175]=30;
pool[176]=30;
pool[177]=30;
pool[178]=30;
pool[179]=30;
pool[180]=30;
pool[181]=30;
pool[182]=30;
pool[183]=30;
pool[184]=31;
pool[185]=31;
pool[186]=31;
pool[187]=31;
pool[188]=31;
pool[189]=32;
pool[190]=32;
pool[191]=32;
pool[192]=32;
pool[193]=32;
pool[194]=32;
pool[195]=32;
pool[196]=32;
pool[197]=32;
pool[198]=33;
pool[199]=33;
pool[200]=33;
pool[201]=33;
pool[202]=33;
pool[203]=33;
pool[204]=34;
pool[205]=34;
pool[206]=34;
pool[207]=34;
pool[208]=34;
pool[209]=34;
pool[210]=34;
pool[211]=34;
pool[212]=34;
pool[213]=35;
pool[214]=35;
pool[215]=35;
pool[216]=35;
pool[217]=35;
pool[218]=35;
pool[219]=35;
pool[220]=35;
pool[221]=35;
pool[222]=36;
pool[223]=36;
pool[224]=36;
pool[225]=36;
pool[226]=36;
pool[227]=36;
pool[228]=36;
pool[229]=36;
pool[230]=36;
pool[231]=36;
pool[232]=37;
pool[233]=37;
pool[234]=37;
pool[235]=37;
pool[236]=38;
pool[237]=38;
pool[238]=38;
pool[239]=38;
pool[240]=38;
pool[241]=38;
pool[242]=39;
pool[243]=39;
pool[244]=39;
pool[245]=39;
pool[246]=39;
pool[247]=39;
pool[248]=39;
pool[249]=39;
pool[250]=39;
pool[251]=39;
pool[252]=39;
pool[253]=40;
pool[254]=40;
pool[255]=40;
pool[256]=40;
pool[257]=40;
pool[258]=41;
pool[259]=41;
pool[260]=41;
pool[261]=41;
pool[262]=41;
pool[263]=41;
pool[264]=41;
pool[265]=41;
pool[266]=41;
pool[267]=42;
pool[268]=42;
pool[269]=42;
pool[270]=42;
pool[271]=42;
pool[272]=42;
pool[273]=42;
pool[274]=42;
pool[275]=43;
pool[276]=43;
pool[277]=43;
pool[278]=43;
pool[279]=43;
pool[280]=43;
pool[281]=43;
pool[282]=43;
pool[283]=43;
pool[284]=44;
pool[285]=44;
pool[286]=44;
pool[287]=44;
pool[288]=44;
pool[289]=44;
pool[290]=44;
pool[291]=44;
pool[292]=44;
pool[293]=44;
pool[294]=44;
pool[295]=44;
pool[296]=44;
pool[297]=44;
pool[298]=45;
pool[299]=45;
pool[300]=45;
pool[301]=45;
pool[302]=45;
pool[303]=45;
pool[304]=45;
pool[305]=45;
pool[306]=45;
pool[307]=45;
pool[308]=46;
pool[309]=46;
pool[310]=46;
pool[311]=46;
pool[312]=46;
pool[313]=46;
pool[314]=46;
pool[315]=46;
pool[316]=46;
pool[317]=46;
pool[318]=46;
pool[319]=47;
pool[320]=47;
pool[321]=47;
pool[322]=47;
pool[323]=47;
pool[324]=47;
pool[325]=47;
pool[326]=47;
pool[327]=48;
pool[328]=48;
pool[329]=48;
pool[330]=48;
pool[331]=48;
pool[332]=48;
pool[333]=48;
pool[334]=49;
pool[335]=49;
pool[336]=49;
pool[337]=49;
pool[338]=49;
pool[339]=49;
pool[340]=49;
pool[341]=49;
pool[342]=49;
pool[343]=49;
pool[344]=49;
pool[345]=49;
pool[346]=50;
pool[347]=50;
pool[348]=50;
pool[349]=50;
pool[350]=50;
pool[351]=50;
pool[352]=50;
pool[353]=50;
pool[354]=50;
pool[355]=50;
pool[356]=51;
pool[357]=51;
pool[358]=51;
pool[359]=51;
pool[360]=51;
pool[361]=51;
pool[362]=51;
pool[363]=51;
pool[364]=51;
pool[365]=52;
pool[366]=52;
pool[367]=52;
pool[368]=52;
pool[369]=52;
pool[370]=52;
pool[371]=53;
pool[372]=53;
pool[373]=53;
pool[374]=53;
pool[375]=53;
pool[376]=53;
pool[377]=53;
pool[378]=53;
pool[379]=54;
pool[380]=54;
pool[381]=54;
pool[382]=54;
pool[383]=54;
pool[384]=54;
pool[385]=54;
pool[386]=54;
pool[387]=54;
pool[388]=55;
pool[389]=55;
pool[390]=55;
pool[391]=55;
pool[392]=55;
pool[393]=55;
pool[394]=55;
pool[395]=55;
pool[396]=55;
pool[397]=55;
pool[398]=55;
pool[399]=56;
pool[400]=56;
pool[401]=56;
pool[402]=56;
pool[403]=56;
pool[404]=56;
pool[405]=56;
pool[406]=56;
pool[407]=56;
pool[408]=56;
pool[409]=56;
pool[410]=56;
pool[411]=56;
pool[412]=56;
pool[413]=56;
pool[414]=57;
pool[415]=57;
pool[416]=57;
pool[417]=57;
pool[418]=57;
pool[419]=57;
pool[420]=57;
pool[421]=58;
pool[422]=58;
pool[423]=58;
pool[424]=58;
pool[425]=58;
pool[426]=58;
pool[427]=58;
pool[428]=58;
pool[429]=58;
pool[430]=58;
pool[431]=59;
pool[432]=59;
pool[433]=59;
pool[434]=59;
pool[435]=59;
pool[436]=59;
pool[437]=59;
pool[438]=59;
pool[439]=59;
pool[440]=59;
pool[441]=59;
pool[442]=59;
pool[443]=59;
pool[444]=59;
std::cout << pool[a], pool[b], pool[c], pool[d], pool[e];
}
system("pause");
}
Feb 1, 2013 at 5:19am UTC
Check carefully your for loop conditions.
Also...holy crap! What's up with those array initializations!? Is that what you were required to do?