Syntax

Everyday kakazoo

Moderators: Enok, Armand

User avatar
Smeagol
Kakaist
Kakaist
Posts: 1422
Joined: Wed Nov 07, 2001 14:32
Location: Vänersborg, Sweden
Contact:

Syntax

Postby Smeagol » Sun Feb 19, 2006 19:41

[syntax="php"]
echo "hej";
[/syntax]
He's not heavy, he's my brother.

User avatar
Smeagol
Kakaist
Kakaist
Posts: 1422
Joined: Wed Nov 07, 2001 14:32
Location: Vänersborg, Sweden
Contact:

Postby Smeagol » Sun Feb 19, 2006 19:46

[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]
He's not heavy, he's my brother.

User avatar
Smeagol
Kakaist
Kakaist
Posts: 1422
Joined: Wed Nov 07, 2001 14:32
Location: Vänersborg, Sweden
Contact:

Postby Smeagol » Sun Feb 19, 2006 19:48

Syntax highlighting seems to be working.
Just use [syntax="language"][/syntax]
He's not heavy, he's my brother.

User avatar
nobile
Kakaist
Kakaist
Posts: 522
Joined: Wed Dec 12, 2001 00:32
MySpace: www.myspace.com/nobile01
Location: Honduras
Contact:

Postby nobile » Sun Feb 19, 2006 19:58

[syntax="java"]
public class TrianguloReflejo
{
public static void main(String arg[])
{
for(int y=10;y>=1;y--)
{
for(int b=y;b>1;b--)
{
System.out.print(" ");
}
for(int x=10;x>=y;x--)
{
System.out.print("*");
}
System.out.println();
}
}
}
[/syntax]
Rolling Eyes
Beauty is in the eyes of the beholder <3

User avatar
nobile
Kakaist
Kakaist
Posts: 522
Joined: Wed Dec 12, 2001 00:32
MySpace: www.myspace.com/nobile01
Location: Honduras
Contact:

Postby nobile » Tue Feb 28, 2006 02:51

[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]
Beauty is in the eyes of the beholder <3


Return to “Kaka Subjects”

Who is online

Users browsing this forum: Google [Bot] and 3 guests