array and for / while
#1

Hello everybody.

Suppose I have a listing test1, test2, test3, test4, test5 array TEST

Код:
enum test
{
test1,
test2,
test3,
test4,
test5
};

new TEST[test];
Please tell me how to read these listings via "for / while"
Here is an example:

Код:
for(new t = 0; t < 5; t++)
{
TEST[test%d] = random(10);
}

( %d = t )
Thank you in advance for your help.
Reply
#2

Quote:
Originally Posted by Day_Jons
Посмотреть сообщение
Hello everybody.

Suppose I have a listing test1, test2, test3, test4, test5 array TEST

Код:
enum test
{
test1,
test2,
test3,
test4,
test5
};

new TEST[test];
Please tell me how to read these listings via "for / while"
Here is an example:

Код:
for(new t = 0; t < 5; t++)
{
TEST[test%d] = random(10);
}

( %d = t )
Thank you in advance for your help.
Код:
for(new t=0; t < 5; ++t) {
    TEST[test:t] = random(10);
}
Reply
#3

Try something like
pawn Код:
for(new t = 0; t < 5; t++)
{
TEST[t] = random(10);
}
Reply
#4

This is what normal arrays are for.
PHP код:
enum test 
{
    
testArray[5],
}

new 
TEST[test];

for(new 
i5i++)
{
    
TEST[testarray][i] = random(10);

I reckon that should work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)