Visa ett inlägg
Oläst 2012-09-21, 23:04 #11
Conny Westh Conny Westh är inte uppkopplad
Klarade millennium-buggen
 
Reg.datum: Aug 2005
Inlägg: 5 166
Conny Westh Conny Westh är inte uppkopplad
Klarade millennium-buggen
 
Reg.datum: Aug 2005
Inlägg: 5 166
Här är samma kod översatt till PHP:

Kod:
<?php
// Program i PHP
// Author: Conny Westh

	class Program
	{
		function Main()
		{
			$rlink = new RefLink();
			$antalWebbPlatser = 21;
			$antalVeckor = 7;

			for ($webbPlats = 1; $webbPlats <= $antalWebbPlatser; $webbPlats++)
			{
				for ($vecka = 1; $vecka <= $antalVeckor; $vecka++)
				{
					$rlink->visa($webbPlats, $vecka, $antalWebbPlatser, $antalVeckor);
				}
				echo "\n";
			}
			//Console.ReadKey();
		}
	}

	class RefLink
	{
		function visa($AktuellWebbPlats, $aktuellVecka, $antalWebbPlatser, $antalVeckor)
		{
			echo "Webbplats: " . $AktuellWebbPlats . ", Vecka: " . $aktuellVecka . ", Visar länk för: ";
			for ($webbPlats = 0; $webbPlats < $antalWebbPlatser; $webbPlats++)
			{
				if ((($webbPlats + 1) != $AktuellWebbPlats) && (((($aktuellVecka - 1 + $webbPlats + $AktuellWebbPlats) % $antalVeckor)) == 0))
				{
					echo " - " . ($webbPlats + 1) ;
				}
			}
			echo "\n";
		}
	}

$r = new Program();

$r->Main();


?>
Conny Westh är inte uppkopplad   Svara med citatSvara med citat