Jump to content
php.lv forumi

Mainiigs Mainiigais


Recommended Posts

Situaacija - tiek sanjemti bezgaliigi daudz mainiigie (m1, m2, m3, m4 u.t.t.), katrs mainiigais satur kaadu skaitli, piem. m1=12, m2=1 u.t.t.

Uzdevums - pa vienam nolasiit mainiigos no m1 liidz m10 un noprinteet tos. Nepaarakstot kodaa print $m1; print $m2; u.t.t.

Taa teikt vajadziigs kaut kaads cikls, kursh pats veido shos mainiigo nosaukumus.

 

Jautaajums - kaa?

Link to post
Share on other sites

iedomaajies ja tev shaadaa stilaa jaaveido 1000 mainiigie... liels darbinsh, kaa arii tikpat liels kods. vajag panaakt, lai pats kods gjeneree shos maniigos un tad ielasa tos. gjeneree m1, ielasa to, saak ciklu no gala - gjeneree m2, ielasa to. u.t.t. cipars ir tas, kas aug.

Link to post
Share on other sites
<code><font color="#000000">
<font color="#0000CC"><?php
$m1</font><font color="#006600">=</font><font color="#0000CC">123</font><font color="#006600">;
</font><font color="#0000CC">$m2</font><font color="#006600">=</font><font color="#0000CC">343</font><font color="#006600">;
</font><font color="#0000CC">$m3</font><font color="#006600">=</font><font color="#0000CC">355</font><font color="#006600">;
for(</font><font color="#0000CC">$i</font><font color="#006600">=</font><font color="#0000CC">1</font><font color="#006600">;</font><font color="#0000CC">$i</font><font color="#006600"><=</font><font color="#0000CC">3</font><font color="#006600">;</font><font color="#0000CC">$i</font><font color="#006600">++)echo </font><font color="#0000CC">$m$i</font><font color="#006600">.</font><font color="#CC0000">' '</font><font color="#006600">;
</font><font color="#0000CC">?></font>
</font>
</code>

Link to post
Share on other sites
×
×
  • Create New...