I have to write a program that will output random words with random letters, in fact I wrote this:
$array=array();
$n=10;
for ($i=0;$i<$n;$i++){
$l=rand(4,10);
?><br><?
for ($j=0;$j<$l;$j++){
$cas=rand(65,90);
$array[$j]=$cas;
if($j>1){
Now, I have to check that there won't be 3 consonants and 3 vocals near to each others. Have I to write IF or WHILE? like
if(($array[$j-1]=65 || $array[$j-1]=69...) && ($array[$j-2]==65...)
if(($array[$j-1]=66 || $array[$j-1]=67)&&($array[$j-2]=66))
or
while(($array[$j-1]==65) && ($array[$j-2]=65)
while(($array[$j-1]==66) && ($array[$j-2]=66)
Aucun commentaire:
Enregistrer un commentaire