unit.php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Friends ^^

I am amature for PHP
I want make unit.php
   so, I make some logic in c++

#include "iostream.h"
#include "iomanip.h"

void main()
{
	int score;
	int m[100], ember;
x:
	{
		cout<<"Please input 10000-99999:";cin>>score;

		if((nilai<10000)||(nilai>99999))
		{
			goto x;


		}
		else
		{
			cout<<"\n\n";
	
			m[1]=score/10000;
			m[2]=(score-(m[1]*10000))/1000;
			m[3]=(score-((m[1]*10000)+(m[2]*1000)))/100;
			m[4]=(score-((m[1]*10000)+(m[2]*1000)+(m[3]
*100)))/10;
			m[5]=(score-(((m[1]*10000)+(m[2]*1000)+(m[3]
*100)+m[4]*10)));

			
			cout<<"five digit:"<<m[1]<<endl;
			cout<<"thousand:"<<m[2]<<endl;
			cout<<"hundred :"<<m[3]<<endl;
			cout<<" dua digit:"<<m[4]<<endl;
			cout<<"one digit:"<<m[5]<<endl;

			for(int p=1;p<=4;p++)
			{
				for(int a=1;a<=4;a++)
				{
					if(m[a]>m[a+1])
					{
					ember=m[a];
					m[a]=m[a+1];
					m[a+1]=ember;
				}
			}
		}
		cout<<"\n\n";
		cout<<"sort : \n";
		for(int y=1;y<=5;y++)
		{
			cout<<setw(4)<<m[y];
			cout<<endl;
		}

		m[1]=m[1]*10000;
		m[2]=(m[2]*1000)+m[1];
		m[3]=(m[3]*100)+m[2];
		m[4]=(m[4]*10)+m[3];
		m[5]=(m[5]*1)+m[4];

		cout<<"\n\n";
		cout<<"after score :";
		cout<<m[5]<<endl;
	}
}}

please help me...
this is my php, but not working...
<html>
<head>
<title> Satuan </title>
</head>
<body>
<?php
			$m[1]=$_POST['score']/10000;
			$m[2]=(score-($m[1]*10000))/1000;
			$m[30]=($_POST['score']-(($m[1]*10000)+($m[2]
*1000)))/100;
			$m[40]=($_POST['score']-(($m[1]*10000)+($m[2]
*1000)+($m[3]*100)))/10;
			$m[50]=($_POST['score']-((($m[1]*10000)+($m
[2]*1000)+($m[3]*100)+$m[4]*10)));

			echo "five digit: $m[1]<br>";
			echo "thousand: $m[2]<br>";
			echo "hundred : $m[30]<br>";
			echo "two digit: $m[40]<br>";
			echo "one digit: $m[50]<br>";

		
?>
<FORM METHOD="POST" ACTION="Satuan.PHP">
<TABLE>
<TR>
<TD>Please input the number : </TD>
<TD><INPUT TYPE="BOOLEAN" NAME="score"></TD>
<TD><P><INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="PROSES"></TD>
</tr>
<br>
</TABLE>
</FORM>
</body>
</html>


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux