<HTML>
<HEAD>
<TITLE></TITLE>
<style type="text/css">
body {
FONT: 9px Verdana, Arial; margin: 0; padding: 0;
}
td {
FONT: 9px Verdana, Arial;
}
*.submit {
FONT: 9px Verdana, Arial; background-color : #FFFFFF;
}
</style>
</HEAD>
<BODY>
<TABLE width="500" cellspacing="0" cellpadding="0" align="center">
<TR><TD>
<TABLE border="1" width="100%" cellspacing="0" cellpadding="0" align="center">
<TR><TD>
Wpisz liczbe w systemie ZM (max 8 bitów)<br><br>
<FORM method="GET" action="index.php">
<input name="wartosc" type="text" maxlength="8" size="10">
<input name="dodawanie" type="checkbox"> dodawanie <input name="odejmowanie" type="checkbox"> odejmowanie<br>
<input class="submit" type="submit" value="licz" size="10">
</FORM>
</TD>
<?
$_GET['wartosc'] = $wartosc;
$ile_znakow = strlen($wartosc);
$x1 = substr($wartosc, 0, 1);
$x2 = substr($wartosc, 1, 1);
$x3 = substr($wartosc, 2, 1);
$x4 = substr($wartosc, 3, 1);
$x5 = substr($wartosc, 4, 1);
$x6 = substr($wartosc, 5, 1);
$x7 = substr($wartosc, 6, 1);
$x8 = substr($wartosc, 7, 1);
if ($ile_znakow < 8)
$znak = 8 - $ile_znakow;
$zero = 0;
if ($znak == 1)
$wartosc = $zero.$wartosc;
else if ($x8 == 1)
$wartosc;
if ($znak == 2)
$wartosc = $zero.$zero.$wartosc;
else if ($x7 == 1)
$wartosc;
if ($znak == 3)
$wartosc = $zero.$zero.$zero.$wartosc;
else if ($x6 == 1)
$wartosc;
if ($znak == 4)
$wartosc = $zero.$zero.$zero.$zero.$wartosc;
else if ($x5 == 1)
$wartosc;
if ($znak == 5)
$wartosc = $zero.$zero.$zero.$zero.$zero.$wartosc;
else if ($x4 == 1)
$wartosc;
if ($znak == 6)
$wartosc = $zero.$zero.$zero.$zero.$zero.$zero.$wartosc;
else if ($x3 == 1)
$wartosc;
if ($znak == 7)
$wartosc = $zero.$zero.$zero.$zero.$zero.$zero.$zero.$wartosc;
else if ($x2 == 1)
$wartosc;
if ($znak == 8)
$wartosc = $zero.$zero.$zero.$zero.$zero.$zero.$zero.$zero.$wartosc;
else if ($x1 == 1)
$wartosc;
if ($x1 == 1)
// zamienia jedynki na 2
$dwa = str_replace("1", "2", $wartosc);
$y1 = substr($dwa, 0, 1);
$y2 = substr($dwa, 1, 1);
$y3 = substr($dwa, 2, 1);
$y4 = substr($dwa, 3, 1);
$y5 = substr($dwa, 4, 1);
$y6 = substr($dwa, 5, 1);
$y7 = substr($dwa, 6, 1);
$y8 = substr($dwa, 7, 1);
if ($y1 == 2)
$y1 = '-';
else
$y1 = '';
if ($y8 == 2)
$y8 = 1;
else if ($y8 == 0)
$y8 = 0;
if ($y7 == 2)
$y7 = 2;
else if ($y7 == 0)
$y7 = 0;
if ($y6 == 2)
$y6 = 4;
else if ($y6 == 0)
$y6 = 0;
if ($y5 == 2)
$y5 = 8;
else if ($y5 == 0)
$y5 = 0;
if ($y4 == 2)
$y4 = 16;
else if ($y4 == 0)
$y4 = 0;
if ($y3 == 2)
$y3 = 32;
else if ($y3 == 0)
$y3 = 0;
if ($y2 == 2)
$y2 = 64;
else if ($y2 == 0)
$y2 = 0;
$dziesietny = $y8+$y7+$y6+$y5+$y4+$y3+$y2;
?>
<TD>
<center><b>Przelicznik</b><br>
ZM : (10)<br><br></center>
<table border="1" width="200" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="80"><center>system ZM</center></td>
<td width="120"><center>system dziesietny</center></td>
</tr>
<tr>
<td width="120"><? echo "<center>$wartosc</center>"; ?></td>
<td width="80"><? echo "<center>$y1$dziesietny</center>"; ?></td>
</tr>
</table>
</TD></TR>
</TABLE>
</TD></TR>
<TR><TD>
tytry
</TD></TR>
</TABLE>
</BODY>
</HTML>
Tyle udalo mi sie nabazgrolic jednak gdzies walnalem gafe i czegos za duzo dodalem... no ale jesli ktos jest chetny jednak do sprostowania to nie pogniewam sie :)