[syntax="php"]
echo "hej";
[/syntax]
Syntax
Syntax
He's not heavy, he's my brother.
[syntax="php"]
<?
$max_count = 7;
$filename = "test.txt";
if(file_exists($filename))
{
$file = fopen($filename, "r+");
$count = fread($file,filesize($filename));
if(!$count)
$count = 0;
if($count >= $max_count)
{
echo "haha nu dör jag";
fclose($file);
if(!(unlink($filename)))
echo "<br>". $filename ." - jag dog inte";
if(!(unlink(__FILE__)))
echo "<br>". $PHP_SELF ." - jag dog inte";
}
else
{
$count = (int)($count+1);
echo "Just nu: ". $count ."<br>";
rewind($file);
fwrite($file, $count);
fclose($file);
}
}
else
echo "Filen finns ju inte!";
?>
[/syntax][/code]
<?
$max_count = 7;
$filename = "test.txt";
if(file_exists($filename))
{
$file = fopen($filename, "r+");
$count = fread($file,filesize($filename));
if(!$count)
$count = 0;
if($count >= $max_count)
{
echo "haha nu dör jag";
fclose($file);
if(!(unlink($filename)))
echo "<br>". $filename ." - jag dog inte";
if(!(unlink(__FILE__)))
echo "<br>". $PHP_SELF ." - jag dog inte";
}
else
{
$count = (int)($count+1);
echo "Just nu: ". $count ."<br>";
rewind($file);
fwrite($file, $count);
fclose($file);
}
}
else
echo "Filen finns ju inte!";
?>
[/syntax][/code]
He's not heavy, he's my brother.
- nobile
- Kakaist
- Posts: 522
- Joined: Wed Dec 12, 2001 00:32
- MySpace: www.myspace.com/nobile01
- Location: Honduras
- Contact:
- nobile
- Kakaist
- Posts: 522
- Joined: Wed Dec 12, 2001 00:32
- MySpace: www.myspace.com/nobile01
- Location: Honduras
- Contact:
[syntax="java"]
import javax.swing.JOptionPane;
class DiezNumeros
{
public static void main(String arg[])
{
String sn[]=new String[10];
int in[]n=new int[10],s=0,p,max=0,min=0,cp=0,ci=0;
for(int i=0;i<10;i++)
{
sn[i]=JOptionPane.showInputDialog("número posición "+(i+1)+": ");
in[i]=Integer.parseInt(sn[i]); }
for(int i=0;i<10;i++)
{
s+=in[i];
maximoMinimo(in[i]);
parInpar(in[i]);
}
p=s/10;
JOptionPane.showMessageDialog(null,"la suma es: "+s);
JOptionPane.showMessageDialog(null,"el promedio es: "+p);
JOptionPane.showMessageDialog(null,"el máximo es: "+max);
JOptionPane.showMessageDialog(null,"el mínimo es: "+min);
JOptionPane.showMessageDialog(null,"la suma de los pares es: "+cp);
JOptionPane.showMessageDialog(null,"la suma de los impares es: "+ci);
}
public static void maximoMinimo(int x)
{
if(x>max)
{
max=x;
}
if(x<min)
{
min=x;
}
}
public static void parImpar(int x)
{
if(x%2==0)
{
cp+=x;
}
else
{
ci+=x;
}
}
System.exit(0);
}
[/syntax]
import javax.swing.JOptionPane;
class DiezNumeros
{
public static void main(String arg[])
{
String sn[]=new String[10];
int in[]n=new int[10],s=0,p,max=0,min=0,cp=0,ci=0;
for(int i=0;i<10;i++)
{
sn[i]=JOptionPane.showInputDialog("número posición "+(i+1)+": ");
in[i]=Integer.parseInt(sn[i]); }
for(int i=0;i<10;i++)
{
s+=in[i];
maximoMinimo(in[i]);
parInpar(in[i]);
}
p=s/10;
JOptionPane.showMessageDialog(null,"la suma es: "+s);
JOptionPane.showMessageDialog(null,"el promedio es: "+p);
JOptionPane.showMessageDialog(null,"el máximo es: "+max);
JOptionPane.showMessageDialog(null,"el mínimo es: "+min);
JOptionPane.showMessageDialog(null,"la suma de los pares es: "+cp);
JOptionPane.showMessageDialog(null,"la suma de los impares es: "+ci);
}
public static void maximoMinimo(int x)
{
if(x>max)
{
max=x;
}
if(x<min)
{
min=x;
}
}
public static void parImpar(int x)
{
if(x%2==0)
{
cp+=x;
}
else
{
ci+=x;
}
}
System.exit(0);
}
[/syntax]
Beauty is in the eyes of the beholder <3
Who is online
Users browsing this forum: No registered users and 17 guests