YUSRAN'S SAID



Kamis, 17 Desember 2009

C/C++ Programmes

DO-WHILE
#include

int I, Y, Z;
int N;
int Sum;
main (){
printf("Masukan bilangan yang akan dijumlahkan : \n ");
scanf("%d",&N),
Sum = 0; Y = 0;
I = 1;
while (Y<(N-1)){
Z = I + Y; printf("%d ", Z);
Y++; Sum = Sum + Z;
I = Z;
}; printf ("jumlah bilangan adalah %d \n ", Sum);
return 0;}
SWITCHCASE
#include
#include "conio.h"
main(){
int kode;
//clrsr();
puts("Menentukan pilihan") ;
puts("1 = Januari");
puts("2 = Februari");
puts("3 = Maret");
puts("4 = April");
puts("5 = Mei");
puts("6 = Jni");
puts("7 = Juli");
puts("8 = Agustus");
puts("9 = September");
puts("10 = Oktober");
puts("11 = November");
puts("12 = Desember");
printf ("\nMasukkan pilihan anda (1..12):");
scanf ("%d",&kode);
switch (kode){
case 1: puts ("Bulan Januari"); break;
case 2: puts ("Bulan Februari"); break;
case 3: puts ("Bulan Maret"); break;
case 4: puts ("Bulan April"); break;
case 5: puts ("Bulan Mei"); break;
case 6: puts ("Bulan Juni"); break;
case 7: puts ("Bulan Juli"); break;
case 8: puts ("Bulan Agustus"); break;
case 9: puts ("Bulan September"); break;
case 10: puts ("Bulan Oktober"); break;
case 11: puts ("Bulan November"); break;
case 12: puts ("Bulan Desember"); break;
default: puts ("Yang anda masukkan bukan pilhan (1..12) kan ?");
}
}
IF-ELSE
#include
#include
#include

int a, b, c, D;
float x1, x2;
main()
{
clrscr();
printf("XXXXXXXXXXXXXXXX\n");
printf("Program Penghitung Persamaan akar kuadrat");
printf("Masukkan Nilai a, b, dan c\n (dipisahkan dengan spasi/enter!\n");
scanf("%d %d %d", &a, &b, &c);
printf("xxxxxxxxxxxxxxx\n");
printf("persamaan kuadrat: (%d)x^2 + (%d)x + (%d) \n", a, b, c);
D=(b+b) - (4*a*c);
if (D > 0) {
x1 = (-b + sqrt(D))/(2*a);
x2 = (-b - sqrt(D))/(2*a);
printf ("akar ke-1 = %f dan akar ke-2 = %f\n", x1, x2); }
else{
printf("D akar imaginer!!!\n");
}
return 0;
}
FORSTAT
#include
/* menjumlah deret 1+2+3+...+N dengan N adalah bilangan bulat positif yang
dibaca dari piranti masukan Jumlah deret dicetak ke output*/
main() {
//deklarasi//
int N;
int angka;
int jumlah;
printf("Berapa n = "); scanf("%d",&N);
jumlah=0 ;
for(angka=1;angka<=N;angka++){
jumlah=jumlah + angka;
}
printf("jumlah deret = %d", jumlah);
}
ARRAY
#include
/*Program Array
;Nama File: array.c
;Tgl : 17 April 2008
;------------------
;Contoh program kecil untuk mendeklarasikan, mengisi array melalui 2 cara
;yaiut assignment statement dan masukkan dari keyboard
;----------------------------------
*/

/*Kamus*/
int bil[5];
int i;

/*Algoritma*/
main()
{
/*--------ASSIGNMENT STATEMENT*/
bil[0]=1;
bil[1]=6;
bil[2]=8;
bil[3]=9;
bil[4]=10;
i=1;

/*------OUTPUT*/
while (i<=5)
{
printf("%d", (bil[i-1]));
i++;
}
/*Masukkan nilai array melalui input dari keyboard*/
/*----INPUT-------*/
i=1;
do
{ printf("\n Masukkan Bilangan:");
scanf("%d", &(bil[i-1]));
i++;
}
while (i<=5);
i=1;
do
{
printf("%d",(bil[i-1]));
i++;
}
while(i<=5);
}
ARRAY-FOR
#include
/*Program Array
;Nama File: array.c
;Tgl : 17 April 2008
;------------------
;Contoh program kecil untuk mendeklarasikan, mengisi array melalui 2 cara
;yaiut assignment statement dan masukkan dari keyboard
;----------------------------------
*/

/*Kamus*/
int bil[5];
int i;

/*Algoritma*/
main()
{
/*--------ASSIGNMENT STATEMENT*/
bil[0]=1;
bil[1]=6;
bil[2]=8;
bil[3]=9;
bil[4]=10;

/*------OUTPUT*/
for(i=1;i<=5;i++);
printf("%d", (bil[i-1]));
/*Masukkan nilai array melalui input dari keyboard*/
/*----INPUT-------*/
for(i=1;i<=5;i++);
{
printf("\n Masukkan Bilangan:");
scanf("%d", &(bil[i-1]));
}
for(i=1;i<=5;i++);
{
printf("%d",(bil[i-1]));
}
}
STRUKTUR-KOMPOSISI
#include
/*Program masukkan nilai titik
;Nama File : komposisi.c
;Tgl : 16 April 2008
Menunggu masukkan dua bilangan yang menyatakan absis dan ordinat dari keyboard*/

/*Kmaus*/
/*Definisi nama type*/
typedef struct
{ float X;
float Y;
} Point;

/*Deklarasi nama variabel titik*/
Point T1;

/*ALGORITMA*/
void main()
{
printf("Masukkan Komponen X dan Y:\n");
scanf("%f %f", &T1.X, &T1.Y);
printf("Nilai: %f dan Y: %f",T1.X, T1.Y);
}
JAM 1 IF ELSE
/*JUDUL*/
/*Program Jam (1)*/
/*membaca bilangan dari keyboard, bilangan ditampung dalam variabel h, m, s.
Nilai variabel h memiliki range [0..23], variabel m dan s memiliki range
[0..59], nilai variabel h, m, s akan dikonstruksikan dalam struktur komposisi
Jam yang terdiri dari . Diketahui variabel J bertipe Jam, maka
J.HH, J.MM, J.SS dapat diakses*/

#include
#include

/*KAMUS*/
typedef struct Jam
{
int HH, MM, SS;
};

Jam J;
int h, m, s;

/*ALGORITMA*/
void main ()
{
printf ("------------JAM (1)--------------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
if (h<0)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (h<24)
{
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
if (m<0)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (m<60)
{
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
if (s<0)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (s=60)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
}
else if (m>=60)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
}
else if (h>=24)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
printf ("-----------TERIMA KASIH-----------\n");
getch();
getch();
}
JAM 2
/*JUDUL*/
/*Program Jam (2)*/
/*membaca bilangan dari keyboard, bilangan ditampung dalam variabel h, m, s.
Nilai variabel h memiliki range [0..23], variabel m dan s memiliki range
[0..59], nilai variabel h, m, s akan dikonstruksikan dalam struktur komposisi
Jam yang terdiri dari . Diketahui variabel J bertipe Jam, maka
J.HH, J.MM, J.SS dapat diakses*/

#include
#include

/*KAMUS*/
typedef struct Jam
{
int HH, MM, SS;
};

Jam J[100];
int h, m, s, jml /*jumlah elemen array*/ , i;

/*ALGORITMA*/
void main ()
{
printf ("------------JAM (2)--------------\n");
printf ("Masukkan banyaknya jam: ");
scanf ("%d", &jml);
printf ("\n");
while (i<=(jml-1)) /*valid jika 0=jml-1*/
{
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
if (h<0)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (h<24)
{
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
if (m<0)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (m<60)
{
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
if (s<0)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (s=60)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
}
else if (m>=60)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
}
else if (h>=24)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
}
printf ("------------TERIMA KASIH---------------\n");
getch();
getch();
}
JAM 3
/*JUDUL*/
/*Program Jam (3)*/
/*membaca bilangan dari keyboard, bilangan ditampung dalam variabel h, m, s.
Nilai variabel h memiliki range [0..23], variabel m dan s memiliki range
[0..59], nilai variabel h, m, s akan dikonstruksikan dalam struktur komposisi
Jam yang terdiri dari . Diketahui variabel J bertipe Jam, maka
J.HH, J.MM, J.SS dapat diakses*/

#include
#include

/*KAMUS*/
typedef struct Jam
{
int HH, MM, SS;
};

Jam J;
int h, m, s, x, Jdetik, Jm, Jumlah, Sisa;

/*ALGORITMA*/
void main ()
{
/*create jam*/
/*membentuk sebuah nilai bertipe jam dengan */
J.HH=0;
J.MM=0;
J.SS=0;
printf ("-----------Create jam-------------\n");
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
/*Baca Jam*/
/*menerima masukan nilai jam dari pengguna*/
printf ("------------Baca jam--------------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
if (h<0)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (h<24)
{
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
if (m<0)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (m<60)
{
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
if (s<0)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (s<60)
{
J.HH=h;
J.MM=m;
J.SS=s;
printf("\n");
/*tulis jam*/
/*menuliskan nilai jam dengan format */
printf ("-------------tulis jam------------\n");
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
}
else if (s>=60)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
}
else if (m>=60)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
}
else if (h>=24)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
/*tambah jam*/
/*menambahkan jumlah menit ke suatu jam current*/
printf ("------------Tambah jam-------------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
if (h<0)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (h<24)
{
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
if (m<0)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (m<60)
{
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
if (s<0)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (s<60)
{
printf ("Masukkan nilai tambah menit: ");
scanf ("%d", &x);
Jdetik=(h*3600+m*60+s);
Jm=(x*60);
Jumlah=Jdetik+Jm;
h=Jumlah/3600;
if (h=60)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
}
else if (m>=60)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
}
else if (h>=24)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
/*Konversi jam ke detik*/
printf ("--------konversi jam ke detik--------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
if (h<0)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (h<24)
{
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
if (m<0)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (m<60)
{
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
if (s<0)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (s=60)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
}
else if (m>=60)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
}
else if (h>=24)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
/*konversi detik ke jam*/
printf ("--------konversi detik ke jam--------\n");
printf ("masukan besarnya detik yang akan dikonversi: ");
scanf ("%d", &Jdetik);
if (Jdetik>=0)
{
h=Jdetik/3600;
if (h<24)
{
Sisa=Jdetik%3600;
m=Sisa/60;
s=Sisa%60;
J.HH=h;
J.MM=m;
J.SS=s;
printf ("\n");
printf ("%d detik = %d:%d:%d \n", Jdetik, J.HH, J.MM, J.SS);
printf ("\n");
}
else
{
printf ("\n");
printf ("Maaf melebihi batas jam!!!!\n");
printf ("\n");
}
}
else
{
printf ("\n");
printf ("Jumlah menit yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
/*next jam*/
/*memajukan komponen HH plus 1*/
printf ("------------next jam-----------------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
if (h<0)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (h<24)
{
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
if (m<0)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (m<60)
{
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
if (s<0)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (s<60)
{
J.HH=h;
J.MM=m;
J.SS=s;
if (J.HH<23)
{
J.HH++;
printf ("\n");
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
}
else if (J.HH=60)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
}
else if (m>=60)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
}
else if (h>=24)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
/*next menit*/
/*memajukan komponen MM plus 1*/
printf ("------------next menit-----------------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
if (h<0)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (h<24)
{
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
if (m<0)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (m<60)
{
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
if (s<0)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (s<60)
{
J.HH=h;
J.MM=m;
J.SS=s;
if (J.MM<59)
{
J.MM++;
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
}
else if(J.MM<60)
{
J.MM=0;
if (J.HH<23)
{
J.HH++;
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
}
else if (J.HH=60)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
}
else if (m>=60)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
}
else if (h>=24)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
/*next detik*/
/*memajukan komponen SS plus 1*/
printf ("------------next detik-----------------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
if (h<0)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (h<24)
{
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
if (m<0)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (m<60)
{
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
if (s<0)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
else if (s<60)
{
J.HH=h;
J.MM=m;
J.SS=s;
if (J.SS<59)
{
J.SS++;
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
}
else if (J.SS<60)
{
J.SS=0;
if (J.MM<59)
{
J.MM++;
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
}
else if(J.MM<60)
{
J.MM=0;
if (J.HH<23)
{
J.HH++;
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
}
else if (J.HH=60)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
}
else if (m>=60)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
}
else if (h>=24)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!! \n");
printf ("Coba ulangi kembali!!!! \n");
printf ("\n");
}
printf ("------------TERIMA KASIH---------------\n");
getch();
getch();
}
JAM 4
/*JUDUL*/
/*Program Jam (4)*/
/*membaca bilangan dari keyboard, bilangan ditampung dalam variabel h, m, s.
Nilai variabel h memiliki range [0..23], variabel m dan s memiliki range
[0..59], nilai variabel h, m, s akan dikonstruksikan dalam struktur komposisi
Jam yang terdiri dari . Diketahui variabel J bertipe Jam, maka
J.HH, J.MM, J.SS dapat diakses*/

#include
#include

/*KAMUS*/
typedef struct Jam
{
int HH, MM, SS;
};

Jam J;
int h, m, s, detik, S, x;

/*create jam*/
/*membentuk sebuah nilai bertipe jam dengan */
void CreateJam (Jam *JJ)
{
(*JJ).HH=0;
(*JJ).MM=0;
(*JJ).SS=0;
}
/*Baca Jam*/
/*menerima masukan nilai jam dari pengguna*/
void BacaJam (Jam *JJ)
{
printf ("Masukkan nilai jam (antara 0-23): ");
scanf ("%d", &h);
if (h<0)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!!\n");
printf ("Silahkan ulangi kembali!!!!\n");
}
else if (h<24)
{
printf ("Masukkan nilai menit (antara 0-59): ");
scanf ("%d", &m);
if (m<0)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!!\n");
printf ("Silahkan ulangi kembali!!!!\n");
}
else if (m<60)
{
printf ("Masukkan nilai detik (antara 0-59): ");
scanf ("%d", &s);
if (s=60)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!!\n");
printf ("Silahkan ulangi kembali!!!!\n");
}
}
else if (m>=60)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!!\n");
printf ("Silahkan ulangi kembali!!!!\n");
}
}
else if (h>=24)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!!\n");
printf ("Silahkan ulangi kembali!!!!\n");
}
(*JJ).HH=h;
(*JJ).MM=m;
(*JJ).SS=s;
}
/*tulis jam*/
/*menuliskan nilai jam dengan format */
void TulisJam (Jam JJ)
{
if (JJ.HH<0)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
else if (JJ.HH<24)
{
if (JJ.MM<0)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
else if (JJ.MM<60)
{
if (JJ.SS<0)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
else if (JJ.SS=60)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
}
else if (JJ.MM>=60)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
}
else if (JJ.HH>=24)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
}
/*konversi Jam ke Detik*/
int JamToDetik (Jam JJ)
{
return (JJ.HH*3600+JJ.MM*60+JJ.SS);
}
/*konversi detik ke jam*/
Jam DetikToJam (int SS)
{
int h, m, s, Sisa;
Jam JJ;
h=(SS/3600);
Sisa=(SS%3600);
m=Sisa/60;
s=Sisa%60;
JJ.HH=h;
JJ.MM=m;
JJ.SS=s;
return JJ;
}
/*Tambah jam*/
/*menambahkan jumlah menit ke suatu jam current*/
void TambahJam (Jam *JJ, int m)
{
int JJdetik, JJm, Hasil;
JJdetik=JamToDetik (*JJ);
JJm=m*60;
Hasil=JJdetik+JJm;
*JJ=DetikToJam (Hasil);
}
/*next jam*/
/*memajukan komponen HH plus 1*/
void NextJam (Jam *JJ)
{
if ((*JJ).HH<0)
{
}
else if ((*JJ).HH<23)
{
(*JJ).HH++;
}
else if ((*JJ).HH==23)
{
(*JJ).HH=0;
}
}
/*next minute*/
/*memajukan komponen MM plus 1*/
void NextMinute (Jam *JJ)
{
if ((*JJ).MM<0)
{
}
else if ((*JJ).MM<59)
{
(*JJ).MM++;
}
else if ((*JJ).MM==59)
{
(*JJ).MM=0;
NextJam (JJ);
}
}
/*next detik*/
/*memajukan komponen SS plus 1*/
void NextDetik (Jam *JJ)
{
if ((*JJ).SS<0)
{
}
if ((*JJ).SS<59)
{
(*JJ).SS++;
}
else if ((*JJ).SS==59)
{
(*JJ).SS=0;
NextMinute (JJ);
}
}

/*ALGORITMA*/
void main ()
{
/* memanggil procedure create jam*/
printf ("-------create jam-------- \n");
CreateJam (&J);
TulisJam (J);
printf ("\n");
/*memanggil procedure BacaJam*/
printf ("--------Baca jam--------- \n");
BacaJam (&J);
printf ("\n");
/* memanggil procedure TulisJam*/
printf ("--------Tulis jam-------- \n");
TulisJam (J);
printf ("\n");
/*memanggil function konversi jam ke detik*/
printf ("--Konversi Jam ke Detik-- \n");
BacaJam (&J);
detik=JamToDetik (J);
if (J.HH<0)
{
}
else if (J.HH<24)
{
if (J.MM<0)
{
}
else if (J.MM<60)
{
if (J.SS<0)
{
}
else if (J.SS<60)
{
printf ("\n");
printf ("jam %d:%d:%d = %d detik\n", J.HH, J.MM, J.SS, detik);
printf ("\n");
}
}
}
printf ("\n");
/*memanggil function konversi detik ke jam*/
printf ("--Konversi Detik ke Jam-- \n");
printf ("Masukkan besarnya detik yang akan dikonversi: ");
scanf ("%d", &S);
J=DetikToJam (S);
TulisJam (J);
printf ("\n");
/*memanggil procedure tambah jam*/
printf ("-------Tambah Jam-------- \n");
BacaJam(&J);
if (J.HH<0)
{
}
else if (J.HH<24)
{
if (J.MM<0)
{
}
else if (J.MM<60)
{
if (J.SS<0)
{
}
else if (J.SS<60)
{
printf ("Masukkan penambahan nilai menit: ");
scanf ("%d", &x);
TambahJam (&J,x);
TulisJam (J);
}
}
}
printf ("\n");
/*memanggil procedure next jam*/
printf ("--------next jam--------- \n");
BacaJam (&J);
NextJam (&J);
TulisJam(J);
printf ("\n");
/*memanggil procedure next minute*/
printf ("------next minute-------- \n");
BacaJam (&J);
NextMinute (&J);
TulisJam (J);
printf ("\n");
/*memanggil procedure next detik*/
printf ("-------next detik-------- \n");
BacaJam (&J);
NextDetik (&J);
TulisJam (J);
printf ("\n");
printf ("---------TERIMA KASIH-------- \n");
getch();
getch();
}
JAM TANPA IF-ELSE
/*JUDUL*/
/*Program Jam (4)*/
/*membaca bilangan dari keyboard, bilangan ditampung dalam variabel h, m, s.
Nilai variabel h memiliki range [0..23], variabel m dan s memiliki range
[0..59], nilai variabel h, m, s akan dikonstruksikan dalam struktur komposisi
Jam yang terdiri dari . Diketahui variabel J bertipe Jam, maka
J.HH, J.MM, J.SS dapat diakses*/

#include
#include

/*KAMUS*/
typedef struct Jam
{
int HH, MM, SS;
};

Jam J;
int h, m, s, detik, S, x;

/*create jam*/
/*membentuk sebuah nilai bertipe jam dengan */
void CreateJam (Jam *JJ)
{
(*JJ).HH=0;
(*JJ).MM=0;
(*JJ).SS=0;
}
/*Baca Jam*/
/*menerima masukan nilai jam dari pengguna*/
void BacaJam (Jam *JJ)
{
printf ("Masukkan nilai jam (antara 0-23): ");
scanf ("%d", &h);
if (h<0)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!!\n");
printf ("Silahkan ulangi kembali!!!!\n");
}
else if (h<24)
{
printf ("Masukkan nilai menit (antara 0-59): ");
scanf ("%d", &m);
if (m<0)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!!\n");
printf ("Silahkan ulangi kembali!!!!\n");
}
else if (m<60)
{
printf ("Masukkan nilai detik (antara 0-59): ");
scanf ("%d", &s);
if (s=60)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!!\n");
printf ("Silahkan ulangi kembali!!!!\n");
}
}
else if (m>=60)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!!\n");
printf ("Silahkan ulangi kembali!!!!\n");
}
}
else if (h>=24)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!!\n");
printf ("Silahkan ulangi kembali!!!!\n");
}
(*JJ).HH=h;
(*JJ).MM=m;
(*JJ).SS=s;
}
/*tulis jam*/
/*menuliskan nilai jam dengan format */
void TulisJam (Jam JJ)
{
if (JJ.HH<0)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
else if (JJ.HH<24)
{
if (JJ.MM<0)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
else if (JJ.MM<60)
{
if (JJ.SS<0)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
else if (JJ.SS=60)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
}
else if (JJ.MM>=60)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
}
else if (JJ.HH>=24)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
}
/*konversi Jam ke Detik*/
int JamToDetik (Jam JJ)
{
return (JJ.HH*3600+JJ.MM*60+JJ.SS);
}
/*konversi detik ke jam*/
Jam DetikToJam (int SS)
{
int h, m, s, Sisa;
Jam JJ;
h=(SS/3600);
Sisa=(SS%3600);
m=Sisa/60;
s=Sisa%60;
JJ.HH=h;
JJ.MM=m;
JJ.SS=s;
return JJ;
}
/*Tambah jam*/
/*menambahkan jumlah menit ke suatu jam current*/
void TambahJam (Jam *JJ, int m)
{
int JJdetik, JJm, Hasil;
JJdetik=JamToDetik (*JJ);
JJm=m*60;
Hasil=JJdetik+JJm;
*JJ=DetikToJam (Hasil);
}
/*next jam*/
/*memajukan komponen HH plus 1*/
void NextJam (Jam *JJ)
{
if ((*JJ).HH<0)
{
}
else if ((*JJ).HH<23)
{
(*JJ).HH++;
}
else if ((*JJ).HH==23)
{
(*JJ).HH=0;
}
}
/*next minute*/
/*memajukan komponen MM plus 1*/
void NextMinute (Jam *JJ)
{
if ((*JJ).MM<0)
{
}
else if ((*JJ).MM<59)
{
(*JJ).MM++;
}
else if ((*JJ).MM==59)
{
(*JJ).MM=0;
NextJam (JJ);
}
}
/*next detik*/
/*memajukan komponen SS plus 1*/
void NextDetik (Jam *JJ)
{
if ((*JJ).SS<0)
{
}
if ((*JJ).SS<59)
{
(*JJ).SS++;
}
else if ((*JJ).SS==59)
{
(*JJ).SS=0;
NextMinute (JJ);
}
}

/*ALGORITMA*/
void main ()
{
/* memanggil procedure create jam*/
printf ("-------create jam-------- \n");
CreateJam (&J);
TulisJam (J);
printf ("\n");
/*memanggil procedure BacaJam*/
printf ("--------Baca jam--------- \n");
BacaJam (&J);
printf ("\n");
/* memanggil procedure TulisJam*/
printf ("--------Tulis jam-------- \n");
TulisJam (J);
printf ("\n");
/*memanggil function konversi jam ke detik*/
printf ("--Konversi Jam ke Detik-- \n");
BacaJam (&J);
detik=JamToDetik (J);
if (J.HH<0)
{
}
else if (J.HH<24)
{
if (J.MM<0)
{
}
else if (J.MM<60)
{
if (J.SS<0)
{
}
else if (J.SS<60)
{
printf ("\n");
printf ("jam %d:%d:%d = %d detik\n", J.HH, J.MM, J.SS, detik);
printf ("\n");
}
}
}
printf ("\n");
/*memanggil function konversi detik ke jam*/
printf ("--Konversi Detik ke Jam-- \n");
printf ("Masukkan besarnya detik yang akan dikonversi: ");
scanf ("%d", &S);
J=DetikToJam (S);
TulisJam (J);
printf ("\n");
/*memanggil procedure tambah jam*/
printf ("-------Tambah Jam-------- \n");
BacaJam(&J);
if (J.HH<0)
{
}
else if (J.HH<24)
{
if (J.MM<0)
{
}
else if (J.MM<60)
{
if (J.SS<0)
{
}
else if (J.SS<60)
{
printf ("Masukkan penambahan nilai menit: ");
scanf ("%d", &x);
TambahJam (&J,x);
TulisJam (J);
}
}
}
printf ("\n");
/*memanggil procedure next jam*/
printf ("--------next jam--------- \n");
BacaJam (&J);
NextJam (&J);
TulisJam(J);
printf ("\n");
/*memanggil procedure next minute*/
printf ("------next minute-------- \n");
BacaJam (&J);
NextMinute (&J);
TulisJam (J);
printf ("\n");
/*memanggil procedure next detik*/
printf ("-------next detik-------- \n");
BacaJam (&J);
NextDetik (&J);
TulisJam (J);
printf ("\n");
printf ("---------TERIMA KASIH-------- \n");
getch();
getch();
}
JAM 2 TANPA IF-ELSE
/*JUDUL*/
/*Program Jam (2)*/
/*membaca bilangan dari keyboard, bilangan ditampung dalam variabel h, m, s.
Nilai variabel h memiliki range [0..23], variabel m dan s memiliki range
[0..59], nilai variabel h, m, s akan dikonstruksikan dalam struktur komposisi
Jam yang terdiri dari . Diketahui variabel J bertipe Jam, maka
J.HH, J.MM, J.SS dapat diakses*/

#include
#include

/*KAMUS*/
typedef struct Jam
{
int HH, MM, SS;
};

Jam J [100];
int h, m, s, jml, i;

/*ALGORITMA*/
void main ()
{
printf ("masukkan banyaknya jam: ");
scanf ("%d", &jml);
printf ("\n");
while (i<=(jml-1))
{
printf ("------------JAM(2)--------------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
J[i].HH=h;
J[i].MM=m;
J[i].SS=s;
printf("\n");
printf ("Nilai jam yang ke-%i: %d:%d:%d \n", i+1, J[i].HH, J[i].MM, J[i].SS);
printf ("\n");
i++;
}
printf ("-----------TERIMA KASIH------------- \n");
getch();
getch();
}
JAM 3 TANPA IDF-ELSE
/*JUDUL*/
/*Program Jam (3)*/
/*membaca bilangan dari keyboard, bilangan ditampung dalam variabel h, m, s.
Nilai variabel h memiliki range [0..23], variabel m dan s memiliki range
[0..59], nilai variabel h, m, s akan dikonstruksikan dalam struktur komposisi
Jam yang terdiri dari . Diketahui variabel J bertipe Jam, maka
J.HH, J.MM, J.SS dapat diakses*/

#include
#include

/*KAMUS*/
typedef struct Jam
{
int HH, MM, SS;
};

Jam J;
int h, m, s, x, Jdetik, Jm, Jumlah, Sisa;

/*ALGORITMA*/
void main ()
{
/*create jam*/
/*membentuk sebuah nilai bertipe jam dengan */
J.HH=0;
J.MM=0;
J.SS=0;
printf ("-----------Create jam-------------\n");
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
/*Baca Jam*/
/*menerima masukan nilai jam dari pengguna*/
printf ("------------Baca jam--------------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
J.HH=h;
J.MM=m;
J.SS=s;
printf("\n");
/*tulis jam*/
/*menuliskan nilai jam dengan format */
printf ("-------------tulis jam------------\n");
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
/*tambah jam*/
/*menambahkan jumlah menit ke suatu jam current*/
printf ("------------Tambah jam-------------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
printf ("Masukan nilai tambah: ");
scanf ("%d", &x);
Jdetik=(h*3600+m*60+s);
Jm=(x*60);
Jumlah=Jdetik+Jm;
h=Jumlah/3600;
Sisa=Jumlah%3600;
m=Sisa/60;
s=Sisa%60;
J.HH=h;
J.MM=m;
J.SS=s;
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
/*Konversi jam ke detik*/
printf ("--------konversi jam ke detik--------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
J.HH=h;
J.MM=m;
J.SS=s;
Jdetik=(J.HH*3600+J.MM*60+J.SS);
printf ("%d:%d:%d = %d detik \n", J.HH, J.MM, J.SS, Jdetik);
printf ("\n");
/*konversi detik ke jam*/
printf ("--------konversi detik ke jam--------\n");
printf ("masukan besarnya detik yang akan dikonversi: ");
scanf ("%d", &Jdetik);
h=Jdetik/3600;
Sisa=Jdetik%3600;
m=Sisa/60;
s=Sisa%60;
J.HH=h;
J.MM=m;
J.SS=s;
printf ("%d detik = %d:%d:%d \n", Jdetik, J.HH, J.MM, J.SS);
printf ("\n");
/*next jam*/
/*memajukan komponen HH plus 1*/
printf ("------------next jam-----------------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
J.HH=h;
J.MM=m;
J.SS=s;
J.HH++;
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
/*next menit*/
/*memajukan komponen MM plus 1*/
printf ("------------next menit-----------------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
J.HH=h;
J.MM=m;
J.SS=s;
J.MM++;
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
/*next detik*/
/*memajukan komponen SS plus 1*/
printf ("------------next detik-----------------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
J.HH=h;
J.MM=m;
J.SS=s;
J.SS++;
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
printf ("------------TERIMA KASIH---------------\n");
getch();
getch();
}
JAM 4 TANPA IF-ELSE
/*JUDUL*/
/*Program Jam (3)*/
/*membaca bilangan dari keyboard, bilangan ditampung dalam variabel h, m, s.
Nilai variabel h memiliki range [0..23], variabel m dan s memiliki range
[0..59], nilai variabel h, m, s akan dikonstruksikan dalam struktur komposisi
Jam yang terdiri dari . Diketahui variabel J bertipe Jam, maka
J.HH, J.MM, J.SS dapat diakses*/

#include
#include

/*KAMUS*/
typedef struct Jam
{
int HH, MM, SS;
};

Jam J;
int h, m, s, x, Jdetik, Jm, Jumlah, Sisa;

/*ALGORITMA*/
void main ()
{
/*create jam*/
/*membentuk sebuah nilai bertipe jam dengan */
J.HH=0;
J.MM=0;
J.SS=0;
printf ("-----------Create jam-------------\n");
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
/*Baca Jam*/
/*menerima masukan nilai jam dari pengguna*/
printf ("------------Baca jam--------------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
J.HH=h;
J.MM=m;
J.SS=s;
printf("\n");
/*tulis jam*/
/*menuliskan nilai jam dengan format */
printf ("-------------tulis jam------------\n");
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
/*tambah jam*/
/*menambahkan jumlah menit ke suatu jam current*/
printf ("------------Tambah jam-------------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
printf ("Masukan nilai tambah: ");
scanf ("%d", &x);
Jdetik=(h*3600+m*60+s);
Jm=(x*60);
Jumlah=Jdetik+Jm;
h=Jumlah/3600;
Sisa=Jumlah%3600;
m=Sisa/60;
s=Sisa%60;
J.HH=h;
J.MM=m;
J.SS=s;
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
/*Konversi jam ke detik*/
printf ("--------konversi jam ke detik--------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
J.HH=h;
J.MM=m;
J.SS=s;
Jdetik=(J.HH*3600+J.MM*60+J.SS);
printf ("%d:%d:%d = %d detik \n", J.HH, J.MM, J.SS, Jdetik);
printf ("\n");
/*konversi detik ke jam*/
printf ("--------konversi detik ke jam--------\n");
printf ("masukan besarnya detik yang akan dikonversi: ");
scanf ("%d", &Jdetik);
h=Jdetik/3600;
Sisa=Jdetik%3600;
m=Sisa/60;
s=Sisa%60;
J.HH=h;
J.MM=m;
J.SS=s;
printf ("%d detik = %d:%d:%d \n", Jdetik, J.HH, J.MM, J.SS);
printf ("\n");
/*next jam*/
/*memajukan komponen HH plus 1*/
printf ("------------next jam-----------------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
J.HH=h;
J.MM=m;
J.SS=s;
J.HH++;
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
/*next menit*/
/*memajukan komponen MM plus 1*/
printf ("------------next menit-----------------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
J.HH=h;
J.MM=m;
J.SS=s;
J.MM++;
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
/*next detik*/
/*memajukan komponen SS plus 1*/
printf ("------------next detik-----------------\n");
printf ("masukan nilai jam (antara 0-23): ");
scanf ("%d", &h);
printf ("Masukan nilai menit (antara 0-59): ");
scanf ("%d", &m);
printf ("Masukan nilai detik (antara 0-59): ");
scanf ("%d", &s);
J.HH=h;
J.MM=m;
J.SS=s;
J.SS++;
printf ("Nilai jam: %d:%d:%d \n", J.HH, J.MM, J.SS);
printf ("\n");
printf ("------------TERIMA KASIH---------------\n");
getch();
getch();
}
MENU OPERASI JAM
/*JUDUL*/
/*Program Jam (4)*/
/*membaca bilangan dari keyboard, bilangan ditampung dalam variabel h, m, s.
Nilai variabel h memiliki range [0..23], variabel m dan s memiliki range
[0..59], nilai variabel h, m, s akan dikonstruksikan dalam struktur komposisi
Jam yang terdiri dari . Diketahui variabel J bertipe Jam, maka
J.HH, J.MM, J.SS dapat diakses*/

#include
#include

/*KAMUS*/
typedef struct Jam
{
int HH, MM, SS;
};

Jam J;
int h, m, s, detik, S, x;

/*create jam*/
/*membentuk sebuah nilai bertipe jam dengan */
void CreateJam (Jam *JJ)
{
(*JJ).HH=0;
(*JJ).MM=0;
(*JJ).SS=0;
}
/*Baca Jam*/
/*menerima masukan nilai jam dari pengguna*/
void BacaJam (Jam *JJ)
{
printf ("Masukkan nilai jam (antara 0-23): ");
scanf ("%d", &h);
if (h<0)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!!\n");
printf ("Silahkan ulangi kembali!!!!\n");
}
else if (h<24)
{
printf ("Masukkan nilai menit (antara 0-59): ");
scanf ("%d", &m);
if (m<0)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!!\n");
printf ("Silahkan ulangi kembali!!!!\n");
}
else if (m<60)
{
printf ("Masukkan nilai detik (antara 0-59): ");
scanf ("%d", &s);
if (s=60)
{
printf ("\n");
printf ("Nilai detik yang anda masukkan salah!!!!\n");
printf ("Silahkan ulangi kembali!!!!\n");
}
}
else if (m>=60)
{
printf ("\n");
printf ("Nilai menit yang anda masukkan salah!!!!\n");
printf ("Silahkan ulangi kembali!!!!\n");
}
}
else if (h>=24)
{
printf ("\n");
printf ("Nilai jam yang anda masukkan salah!!!!\n");
printf ("Silahkan ulangi kembali!!!!\n");
}
(*JJ).HH=h;
(*JJ).MM=m;
(*JJ).SS=s;
}
/*tulis jam*/
/*menuliskan nilai jam dengan format */
void TulisJam (Jam JJ)
{
if (JJ.HH<0)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
else if (JJ.HH<24)
{
if (JJ.MM<0)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
else if (JJ.MM<60)
{
if (JJ.SS<0)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
else if (JJ.SS=60)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
}
else if (JJ.MM>=60)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
}
else if (JJ.HH>=24)
{
printf ("\n");
printf ("Maaf sudah melebihi batas jam!!! \n");
}
}
/*konversi Jam ke Detik*/
int JamToDetik (Jam JJ)
{
return (JJ.HH*3600+JJ.MM*60+JJ.SS);
}

/*konversi detik ke jam*/
Jam DetikToJam (int SS)
{
int h, m, s, Sisa;
Jam JJ;
h=(SS/3600);
Sisa=(SS%3600);
m=Sisa/60;
s=Sisa%60;
JJ.HH=h;
JJ.MM=m;
JJ.SS=s;
return JJ;
}
/*Tambah jam*/
/*menambahkan jumlah menit ke suatu jam current*/
void TambahJam (Jam *JJ, int m)
{
int JJdetik, JJm, Hasil;
JJdetik=JamToDetik (*JJ);
JJm=m*60;
Hasil=JJdetik+JJm;
*JJ=DetikToJam (Hasil);
}
/*next jam*/
/*memajukan komponen HH plus 1*/
void NextJam (Jam *JJ)
{
if ((*JJ).HH<0)
{
}
else if ((*JJ).HH<23)
{
(*JJ).HH++;
}
else if ((*JJ).HH==23)
{
(*JJ).HH=0;
}
}
/*next minute*/
/*memajukan komponen MM plus 1*/
void NextMinute (Jam *JJ)
{
if ((*JJ).MM<0)
{
}
else if ((*JJ).MM<59)
{
(*JJ).MM++;
}
else if ((*JJ).MM==59)
{
(*JJ).MM=0;
NextJam (JJ);
}
}
/*next detik*/
/*memajukan komponen SS plus 1*/
void NextDetik (Jam *JJ)
{
if ((*JJ).SS<0)
{
}
if ((*JJ).SS<59)
{
(*JJ).SS++;
}
else if ((*JJ).SS==59)
{
(*JJ).SS=0;
NextMinute (JJ);
}
}

/*ALGORITMA*/
void main ()
{
int i, kode;
printf ("Pilihlah menu operasi yang dapat dilakukan jam di bawah ini: \n");
printf (" 1. Create Jam \n");
printf (" 2. Baca Jam \n");
printf (" 3. Tulis Jam \n");
printf (" 4. Konversi Jam ke detik \n");
printf (" 5. Konversi detik ke jam \n");
printf (" 6. Tambah Jam \n");
printf (" 7. Next Jam \n");
printf (" 8. Next Minute \n");
printf (" 9. Next Detik \n");
printf ("\n");
printf ("Anda memilih menu nomor: ");
scanf ("%d", &i);
printf ("\n");
if (i<1)
{
printf ("Maaf anda memasukkan angka yang salah!!!!\n");
printf ("\n");
}
else if (i==1)
{
printf ("-----------Create jam------------ \n");
CreateJam (&J);
TulisJam (J);
}
else if (i==2)
{
printf ("-----------Baca Jam------------ \n");
BacaJam(&J);
TulisJam(J);
}
else if (i==3)
{
printf ("-----------Tulis Jam------------ \n");
BacaJam (&J);
TulisJam (J);
}
else if (i==4)
{
printf ("------Konversi Jam ke Detik-------- \n");
BacaJam (&J);
detik=JamToDetik(J);
if (J.HH<0)
{
}
else if (J.HH<24)
{
if (J.MM<0)
{
}
else if (J.MM<60)
{
if (J.SS<0)
{
}
else if (J.SS<60)
{
printf ("\n");
printf ("jam %d:%d:%d = %d detik \n", J.HH, J.MM, J.SS, detik);
}
}
}
}
else if (i==5)
{
printf ("------Konversi Detik ke Jam-------- \n");
printf ("\n");
printf ("Masukkan besarnya detik yang akan dikonversi: ");
scanf ("%d", &S);
J=DetikToJam (S);
TulisJam (J);
}
else if (i==6)
{
printf ("-----------Tambah Jam------------ \n");
BacaJam(&J);
if (J.HH<0)
{
}
else if (J.HH<24)
{
if (J.MM<0)
{
}
else if (J.MM<60)
{
if (J.SS<0)
{
}
else if (J.SS9)
{
printf ("Maaf anda memasukkan angka yang salah!!!!\n");
printf ("\n");
}
printf ("\n");
printf ("---------TERIMA KASIH----------- \n");
getch();
getch();
}
BATAVIA AIR LINES
#include
#include

typedef struct{
int jam;
int menit;
} waktu;
typedef struct {
char KP[99];
waktu WK;
int SBB;
} Pesawat;
Pesawat P [99];
int i, x=0;

void urutan (Pesawat T[99], int n) {
int x,c;
char temp [99];
while (c<n)
{
if ((T[x]).WK.jam<(T[x+1]).WK.jam)
{
temp=(T[x]).KP;
(T[x]).KP=(T[x+1]).KP;
(T[x+1]).KP=temp;
}
else
if ((T[x]).WK.jam==(T[x+1]).WK.jam)
{
if ((T[x]).WK.menit<(T[x+1]).WK.menit)
{
temp=(T[x]).KP;
(T[x]).KP=(T[x+1]).KP;
(T[x+1]).KP=temp;
}
else
if ((T[x]).WK.menit==(T[x+1]).WK.menit)
{
if ((T[x]).SBB<(T[x]).SBB)
{
temp=(T[x]).KP;
(T[x]).KP=(T[x+1]).KP;
(T[x+1]).KP=temp;
}
}
}
for (x=0;x<i;x++) {
cout << "pesawat ke-"<<x+1<< ":" << P[x+1].KP << " "<<
P[x+1].WK.jam << ":" << P[x+1].WK.menit << " " <<
P[x+1].SBB<< endl;}
}
}

int main()
{
cout <> i;
if (i>0 && i<=100) {
while (x<i){
cout <> P[x].KP;
cout << "masukkan waktu kedatangan: " << endl <> P[x].WK.jam;
if (P[x].WK.jam>0 && P[x].WK.jam<24) {
cout <> P[x].WK.menit;
if (P[x].WK.menit>0 && P[x].WK.menit<60){
cout <> P[x].SBB;
x++;}
else
cout << "silahkan ulangi kembali \n";}
else
cout << "silahkan ulangi kembali\n";}}
else
cout << "Tidak memenuhi kuota yang disediakan" << endl;
urutan (&P[x],i);
system("PAUSE");
return 0;
}
MENARA HANOI
#include
#include

typedef struct{
int jam;
int menit;
} waktu;
typedef struct {
char KP[99];
waktu WK;
int SBB;
} Pesawat;
Pesawat P [99];
int i, x=0;

void urutan (Pesawat T[99], int n) {
int x,c;
char temp [99];
while (c<n)
{
if ((T[x]).WK.jam<(T[x+1]).WK.jam)
{
temp=(T[x]).KP;
(T[x]).KP=(T[x+1]).KP;
(T[x+1]).KP=temp;
}
else
if ((T[x]).WK.jam==(T[x+1]).WK.jam)
{
if ((T[x]).WK.menit<(T[x+1]).WK.menit)
{
temp=(T[x]).KP;
(T[x]).KP=(T[x+1]).KP;
(T[x+1]).KP=temp;
}
else
if ((T[x]).WK.menit==(T[x+1]).WK.menit)
{
if ((T[x]).SBB<(T[x]).SBB)
{
temp=(T[x]).KP;
(T[x]).KP=(T[x+1]).KP;
(T[x+1]).KP=temp;
}
}
}
for (x=0;x<i;x++) {
cout << "pesawat ke-"<<x+1<< ":" << P[x+1].KP << " "<<
P[x+1].WK.jam << ":" << P[x+1].WK.menit << " " <<
P[x+1].SBB<< endl;}
}
}

int main()
{
cout <> i;
if (i>0 && i<=100) {
while (x<i){
cout <> P[x].KP;
cout << "masukkan waktu kedatangan: " << endl <> P[x].WK.jam;
if (P[x].WK.jam>0 && P[x].WK.jam<24) {
cout <> P[x].WK.menit;
if (P[x].WK.menit>0 && P[x].WK.menit<60){
cout <> P[x].SBB;
x++;}
else
cout << "silahkan ulangi kembali \n";}
else
cout << "silahkan ulangi kembali\n";}}
else
cout << "Tidak memenuhi kuota yang disediakan" << endl;
urutan (&P[x],i);
system("PAUSE");
return 0;
}
PROBLEM 2-A
#include
#include


struct converted{
char res[100];
int n;
};

char initSymbol(int x);

converted reverse(converted con);

converted convertBase(int a, int b);

int comparedSymbol(converted ab, converted ac);

int simSymbol(int A, int B, int C);

int main()
{
int i, N, A, B, C;
int sim[10], ret;

scanf("%d", &N);

for (i = 0; i < N; i++){
scanf("%d", &A);
scanf("%d", &B);
scanf("%d", &C);
sim[i] = simSymbol(A, B, C);
}

scanf("%d", &ret);

for (i = 0; i < N; i++){
printf("%d\n\n", sim[i]);
}
system("PAUSE");
return ret;
}

char initSymbol(int x){
int i;
char c;

for(i = 10, c = 'A' ; i < 49; i++, c++){
if(i==36) c = 'a';
if(x==i) return c;
}
}

converted reverse(converted con){
int i, max = con.n;
char temp;

for(i = 0; i = b){
con.res[i] = initSymbol(a%b);
con.n++;
a /= b;
i++;
}
if (a!=0) con.res[i] = initSymbol(a);

return reverse(con);
}

int comparedSymbol(converted ab, converted ac){
int i, j, count = 0;

for(i = 0; i < ab.n; i++){
for(j = 0; j < ac.n; j++){
if(ab.res[i]==ac.res[j]) count++;
}
}

return count;
}

int simSymbol(int A, int B, int C){
converted AB, AC;

AB = convertBase(A, B);
AC = convertBase(A, C);

return comparedSymbol(AB, AC);
}
STRUKTUR GERBONG
#include
#include
typedef struct
{
int nokursi;
int statuskursi;
} InfoKursi;

typedef struct
{
InfoKursi Kursi[4][10];
}Gbg;

Gbg Gerbong[10];

main()
{
/* Inisialisasi nomor kursi */
int gb, kolom, baris;
gb=0;
while (gb < 10)
{
kolom = 0;
while (kolom < 10)
{
baris = 0;
while (baris < 4 )
{
Gerbong[gb].Kursi[baris][kolom].nokursi = 4 * (kolom) + (baris+1);
// Gerbong[gb].Kursi[baris][kolom].statuskursi = 0;
baris++;
}
kolom++;
}
gb++;
}

/* cetak nomor kursi */
baris = 0;
while (baris < 4)
{
int kolom = 0;
while (kolom < 10 )
{
printf ("%d ",Gerbong[0].Kursi[baris][kolom].nokursi);
kolom++;
}
printf("\n");
baris++;
}

system("pause");
}
MESIN KARAKTER
#include
#include

#include
#include
#include
#define bool unsigned char
#define true 1
#define false 0

struct TabKar{
char Kar[100];
int Neff;
};

struct TabReal{
float Real[20];
int Neff;
};

bool Angka(char x){
if((isspace(x)) || (x=='.')) return false;
else return true;
}

void CreateTab(TabKar* T){
(*T).Neff = 0;
}

void IsiTab(TabKar* T){
int i = 0;
printf("Isi pita : ");
scanf("%s", (*T).Kar);
for (i ; i < 100; i++){
(*T).Neff++;
if ((*T).Kar[i]=='.') break;
}
}

void TransformAngka(TabKar T, TabReal* TR){
int i;
int j = 0;
int k = 0;
char nilai[10];

for (i = 0; i < T.Neff; i++){

while(Angka(T.Kar[i])){
nilai[j] = T.Kar[i];
i++;
j++;
}

(*TR).Real[k] = atof(nilai);
(*TR).Neff++;
k++;
farfree(nilai;
j = 0;

while(!Angka(T.Kar[i])) i++; i -= 1;
}
}

void CariAngkaTerbesar(TabReal TR){
struct {
float First;
float Second;
float Third;
} Biggest;

int i;
Biggest.First = TR.Real[0];
for (i = 1; i Biggest.First)r:{
Biggest.Third = Biggest.Second;
Biggest.Second = Biggest. First;
Biggest.First = TR.Real[i];}
else {if (TR.Real[i] > Biggest.Second){
Biggest.Second = Biggest. First;
Biggest.First = TR.Real[i];}
else if (TR.Real[i] > Biggest.Third)
Biggest.Third = TR.Real[i];}
}

printf("Angka terbesar : \n");
printf("%.1f\n", Biggest.First);
printf("%.1f\n", Biggest.Second);
printf("%.1f\n", Biggest.Third);
}

int main(){
TabKar T;
TabReal TR;
CreateTab(&T);
IsiTab(&T);
TransformAngka(T, &TR);
CariAngkaTerbesar(TR);
return 0;
}
MINESWEEPER
/* ========================================================================== */
/* */
/* Minesweeper.c */
/* (c) 2001 Agam Maulana */
/* */
/* Description */
/* */
/* ========================================================================== */

#include

struct Minesweeper{
int Map[100][100];
int Rows;
int Columns;
int Mines;
};

void CreateMap(Minesweeper* MW);
int CountMine(int Row, int Column, Minesweeper MW);
void PrintMap(Minesweeper MW);

int main()
{
Minesweeper MW;
int i;
int Row, Column;

scanf("%d %d", &MW.Columns, &MW.Rows);
scanf("%d", &MW.Mines);
for (i = 0; i < MW.Mines; i++){
scanf("%d %d", &Row, &Column);
MW.Map[Row-1][Column-1] = 9; // int 9 mewakili mine (*)
}

CreateMap(&MW);
PrintMap(MW);

return 0;
}

void CreateMap(Minesweeper* MW){
int Row, Column;

for(Row = 0; Row < (*MW).Rows; Row++){
for(Column = 0; Column < (*MW).Columns; Row++){
if ((*MW).Map[Row][Column]!=9)
(*MW).Map[Row][Column] = CountMine(Row, Column, *MW); // menghitung jumlah mine di sekeliling cell
}
}
}

int CountMine(int Row, int Column, Minesweeper MW){
int Count = 0;
int i, j;

for (i = Row - 1; i <= Row + 1; i++){
for (j = Column - 1; j <= Column + 1; j++){
if (MW.Map[i][j]==9) Count++;
}
}

return Count;
}

void PrintMap(Minesweeper MW){
int i, j;

for (i = 0; i < MW.Rows; i++){
for (j = 0; j < MW.Columns; j++){
printf("%d", MW.Map[i][j]);
}
printf("\n");
}
}
REKENING BANK
#include
#include

void Satuan(long bilangan){
switch (bilangan){
case 1 : printf("satu ");break;
case 2 : printf("dua ");break;
case 3 : printf("tiga ");break;
case 4 : printf("empat ");break;
case 5 : printf("lima ");break;
case 6 : printf("enam ");break;
case 7 : printf("tujuh ");break;
case 8 : printf("delapan ");break;
case 9 : printf("sembilan ");break;
}
}
void Puluhan(long bilangan){
long bagi = bilangan/10, sisa = bilangan%10;
if (bagi>=2){
Satuan(bagi);printf("puluh ");}
else{
if (sisa==0)
printf("sepuluh ");
else{
if (sisa==1){
printf("sebelas ");printf("\n");}
else{
Satuan(sisa);printf("belas ");
}
}
}
}

void Ratusan(long bilangan){
long bagi = bilangan/100, sisa = bilangan%100;
if (bagi<2)
printf("seratus ");
else{
Satuan(bagi);printf("ratus ");}
}

void Ribuan(long bilangan){
long bagi = bilangan/1000, sisa = bilangan%1000;
if (bagi<2)
printf("seribu ");
else{
Satuan(bagi);printf("ribu ");}
}

void Jutaan(int bilangan){
long bagi = bilangan/1000000, sisa = bilangan%1000000;
Satuan(bagi);printf("juta ");
}

void Konversi(long bilangan){
if (bilangan = 10)
Puluhan(bilangan);
else
if (bilangan < 10)
Satuan(bilangan);}
else{
if (bilangan <100){
Puluhan(bilangan);
Konversi(bilangan % 10);}
else{
if (bilangan < 1000){
Ratusan(bilangan);
Konversi(bilangan % 100);}
else{
if (bilangan < 1000000){
Konversi(bilangan / 1000);printf("ribu ");
Konversi(bilangan % 1000);}
else{
Konversi(bilangan / 1000000);printf("juta ");
Konversi(bilangan % 1000000);}}}}
}

main()
{
long bil;
printf("Masukkan bilangan yang akan dikonversi : ");
scanf("%d", &bil);
Konversi(bil);
printf("\n");
system("pause");
}
MASUKAN BILANGAN
#include
#include
int main()
{awal:
int x;
int digs;
printf ("masukan bilangan");
scanf ("%d",&x);
x=sqrt(x*x) ;
char buffer[33];
itoa (x,buffer,10);
printf (buffer);
digs=strlen (buffer);
printf ("banyaknya digit adalah:%u ",digs);

goto awal;
}
MASUKAN SATU ABJAD
#include
#include
#include
#include

int main()
{awal:
char abjad;
printf ("masukan satu abjad:");
scanf ("%c",&abjad);
switch (abjad)
{
case 'A': printf ("1\n");break;
case 'a': printf ("1\n");break;
case 'B': printf ("2\n");break;
case 'b': printf ("2\n");break;
case 'C': printf ("3\n");break;
case 'c': printf ("3\n");break;
case 'D': printf ("4\n");break;
case 'd': printf ("4\n");break;
case 'E': printf ("5\n");break;
case 'e': printf ("5\n");break;
case 'F': printf ("6\n");break;
case 'f': printf ("6\n");break;
case 'G': printf ("7\n");break;
case 'g': printf ("7\n");break;
case 'H': printf ("8\n");break;
case 'h': printf ("8\n");break;
case 'I': printf ("9\n");break;
case 'i': printf ("9\n");break;
case 'J': printf ("10\n");break;
case 'j': printf ("10\n");break;
case 'K': printf ("11\n");break;
case 'k': printf ("11\n");break;
case 'L': printf ("12\n");break;
case 'l': printf ("12\n");break;
case 'M': printf ("13\n");break;
case 'm': printf ("13\n");break;
case 'N': printf ("14\n");break;
case 'n': printf ("14\n");break;
case 'O': printf ("15\n");break;
case 'o': printf ("15\n");break;
case 'P': printf ("16\n");break;
case 'p': printf ("16\n");break;
case 'Q': printf ("17\n");break;
case 'q': printf ("17\n");break;
case 'R': printf ("18\n");break;
case 'r': printf ("18\n");break;
case 'S': printf ("19\n");break;
case 's': printf ("19\n");break;
case 'T': printf ("20\n");break;
case 't': printf ("20\n");break;
case 'U': printf ("21\n");break;
case 'u': printf ("21\n");break;
case 'V': printf ("22\n");break;
case 'v': printf ("22\n");break;
case 'W': printf ("23\n");break;
case 'w': printf ("23\n");break;
case 'X': printf ("24\n");break;
case 'x': printf ("24\n");break;
case 'Y': printf ("25\n");break;
case 'y': printf ("25\n");break;
case 'Z': printf ("26\n");break;
case 'z': printf ("26\n");break;
default: printf ("satu huruf aja yak.....\n");

}
goto awal;


}
MASUKAN KOMPONEN ARRAY
#include
#include
#include
int big;
int n,i,a,c,b=0;
int ket=0;
int nums[10000];
int bandingkan(int x)
{
if (x>10)
{
return 1;

}
else
{
return 0;
}
}
int main()
{ awal:
printf ("\n berapa komponen array yang anda inginkan?\n");
scanf ("%d",&n);
while (i<n)
{ printf ("\n masukan komponen array ke %d: \n",i+1) ;
scanf ("%d",&nums[i]);
printf ("nilai array ke %d adalah: %d",i+1,nums[i]);
i+=1;
}

while (i<n)
{
if (bandingkan (nums [i+1])==1)
ket +=1 ;
i +=1;
}
if (ket==0)
{
big=0;
}
else
{
while (i10)
a=nums[i+1]-10;
c=a-b;
if (c<0)
{
b=a;
}
}
big=b ;

}
printf ("%d",big) ;



goto awal;
system("PAUSE");
return 0;
}

11th IVED,UDAYANA BALI '08

GUIDELINES FOR DEBATERS

Introduction

This document is an introduction to Australasian Parliamentary debates, the motions/topics, team structure, etc. It is meant to help institutions and universities who are new to the Parliamentary debating format and are interested in participating in a debating competition using the format, but are still unclear on the rules and regulations. This document is not intended to serve as a definitive guide to the rules of the tournament.

The Basic Of Debating

Debating is about developing your communication skills. It is about assembling and organizing effective arguments, persuading and entertaining an audience, and using your voice and gestures to convince an adjudicator that your arguments outweigh your oppositions. Debating is not about personal abuse, irrational attacks or purely emotional appeals.
A debate is held between two teams of three members each. These two teams will be referred to as the Affirmative and the Negative. Members of each team are assigned positions as 1st, 2nd, and 3rd speakers. For each debate, a motion is given. After the motion is given, teams are given thirty (30) minutes to prepare for each debate.
Each of the speakers will deliver a substantial speech of seven (7) minutes duration and either the 1st or the 2nd speaker on both sides will deliver the reply speeches for their teams. Reply speeches will be five (5) minutes.
Thus, the complete order of speaking during a debate is as follows:
1st Affirmative – 7 minutes
1st Negative – 7 minutes
2nd Affirmative – 7 minutes
2nd Negative – 7 minutes
3rd Affirmative – 7 minutes
3rd Negative – 7 minutes
Negative Reply – 5 minutes
Affirmative Reply – 5 minutes

What must both sides do? In general:
Affirmative (also known as “the Government”)
The Affirmative team must define the motion and support this by giving constructive arguments. The right to define first resides with the Affirmative team, who is expected to give a reasonable definition for the motion.
Negative (also known as “the Opposition”)
The Negative team must oppose the motion as defined by the Affirmative, and build a counter-case against the Affirmative. In the event the Negative team feels that the definition is invalid, they may challenge the definition and propose an alternative definition. However, the Negative team cannot raise a challenge simply on the basis that their definition is more reasonable.

Motions

Motions, also known as topics, are full propositional statements that determine what a debate shall be about. In the debate, the Affirmative team must argue to defend the propositional statement of the motion, and the Negative team must argue to oppose it.
Here are some examples of motions that can be debated about:
That we should give President Habibie a chance
That Indonesia should change its constitution
That football is overvalued in today’s society
That cigarette companies should not be held responsible for the bad effects of smoking
That American pop culture is a threat to civilization
That long is better than short

Definition

Before a debate ensues, the motion that is given must first be defined by the Affirmative team. A definition clarifies the motion. A definition gives a clear description of boundaries to the motion, thereby limiting what the debate will be about into a focused area of discussion. This prevents the debate from turning into a vague and confusing show of unrelated arguments and different interpretations from both teams of what is actually being debated among them.
The definition should take the motion as a whole, defining individual words only if they have a key role. Out of the definition should come a clear understanding of the issues that will be fought over in the debate. If the Affirmative chooses to define the motion on a word-by-word basis, it should define words or phrases by their common usage. Dictionaries may be useful for finding a common meaning or a pithy explanation of a word, but they are not an absolute authority.
An example of a definition could be as follows: Given the motion “that what goes up, must come down”, the Affirmative is presented with many options on how to define the motion, because the nature of the motion itself is quite abstract. One way they could define it is as follows: they could define the object (the ‘what’) as being the president of the Republic of Indonesia. In essence, the motion would then state that anyone who “goes up” (takes power) as president of Indonesia, must undoubtedly one day “come down” (step down from power). This would give us the definition “that the Indonesian presidency should be limited to 2 terms”. The Affirmative team could then argue on the detriments of having unlimited presidential terms, citing proof such as the total control of the past regime under Soeharto, etc.
The above example shows that in most situations, the actual issue of the debate is unknown until the Affirmative delivers their definition of the motion. Only then does it become clear.
Always keep in mind that a definition must be reasonable. This is to say that:
it must be debatable (i.e. have two sides to it), and
it must not be a bizarre distortion of the motion.

This is not to say that an Affirmative team may not choose an unusual interpretation of the motion, but they must be prepared to justify it.
The Negative, in general, must accept the definition made by the Affirmative, but the Negative shall have the right of challenging the definition if it does not conform to either of the two requirements set out above. However, a Negative team cannot raise a challenge simply on the basis that their definition seems more reasonable. They can only challenge a definition if they can prove it to be either Truistic, Tautological, Squirreling, or Time and place setting (see below).
If a Negative team accepts the definition, they only need to say so, and it is unnecessary to restate it. If they challenge it, their justification for doing so must be clearly stated, and an alternative definition must be put forward. If the definition is accepted, then that definition must stand. The Negative must adjust their case to that definition, and the adjudicator's views on its reasonableness become irrelevant.
The following definitions are strictly prohibited at the tournament, and should be challenged by the Negative team:
Truistic definitions: These are definitions which are ‘true’ by nature and thus make the proposed arguments unarguable and therefore unreasonable in the context of the debate. If a team defines the debate truistically, they seek to win the debate by the truth of their definition rather than by the strength of their arguments and supporting evidence. An example of a truistic definition would be if the motion “that we should eat, drink, and be merry” were defined as “that we should eat, because otherwise we would starve to death; drink, because otherwise we would die of thirst; and be merry because we are alive”.
Tautological or circular definitions: This happens when a definition is given in such a way that it is logically impossible to negate it. An example would be if the motion “that technology is killing our work ethic” were defined as follows: the Affirmative team decides to define the term ‘technology’ as meaning “all scientific advancements that make life easier and therefore kills our work ethic”. This would result in the whole definition “that all scientific advancements that make life easier and therefore kills our work ethic is killing our work ethic”. This cannot be logically proven false.
Squirreling: Definitions that are not tied down to the spirit of the motion and do not have a proper logical link to the motion will constitute squirreling. For instance, when given the motion “that the USA is opening up to the PRC”, an Affirmative team could try and define USA as “Untidy Students of Asia”, and PRC as “Pretty Room Cleaners”. This is definitely squirreling, as anyone would agree that the spirit of the motion is about the relationship between the United States and China!
Time and Place-setting: The subject matter of the debate cannot be confined to a particular time and place. For instance, trying to limit the subject matter to only the economic development of Japan during the specific period of the Meiji restoration.

A note on definitional challenges: be very careful about challenging definitions - only do so if you are absolutely certain that the Affirmative's definition is unfair. It is better to be brave and dump your prepared case in favor of tackling the Affirmative on their own terms than to issue an unjustified definition challenge. By the same token, Affirmative teams should try to ensure that their definition is fair.

Theme Line

The theme line is the underlying logic of a team’s case. It is the main instrument of argumentation that is used to prove a team’s stand on the motion. A theme line can be viewed as a ‘Case In A Nutshell’, because it concisely explains a team’s strategy in defending or negating the motion.
The theme line of a team must heavily imbue each speech of every team member. It is the main idea that links together the first, second, and third speakers, ensuring consistency among all speeches.
In formulating a theme line, it is often helpful to ask the question: Why is the propositional statement given by the definition of the motion true (or false, for the Negative team)? Without further explanation, this propositional statement is a mere assertion, or a statement which is logically unproven to be true. The answer to this question must be an argument which proves the assertion given by the motion. This argument is the theme line.
A theme line should be kept short, and it may take a form of a single sentence, an arrangement of several statements into a logical syllogism, etc. Whatever it is, it must by itself prove the motion (as it is defined) and all arguments brought forward should be based on this theme line.

Theme Split

Debating is a team activity. One person cannot take all the arguments and become the sole defender of the team's case. Therefore, there is a need to decide on how the arguments should be distributed among speakers. This is called the team split. Simply put, the team split is the distribution of arguments to the first, second, and third speaker.
Be careful, though, that each individual speech by itself must already prove the motion. You should not create what is called a hung case. A hung case is when an individual speech fails to prove the motion by itself, but instead requires coupling it with other speeches to be able to finally prove the motion.
For a more elaborate exposition on formulating theme lines and team splits, please consult the document entitled “Casebuilding Examples of Australasian Parliamentary Debates”. It contains thorough examples that give a very clear idea on how to construct theme lines and team splits from definitions.

Arguments

Argumentation is the process of explaining why a point of view should be accepted. It concerns the logic and the evidence supporting a particular conclusion. Use evidence (i.e. examples, facts, statistics, quotations of expert/public opinion etc.) to back up each point you make in your argument. Show how each piece of evidence is relevant and how it advances your argument. Make a point, give the reason for that point, and supply evidence to back it up.
Arguments are not assertions. Assertions are statements that have yet to be proven to be logically true. On the other hand, arguments must have supporting logic and facts that can show its validity.
What adjudicators look for in a good argument
Relevance
Organization
Consistency and internal logic - i.e. don't contradict yourself or your teammates
Clarity (remember, debating is about persuading your audience and adjudicator that you're right - so make sure they can understand what you're saying!)
Effective use of evidence

Preparing a Reasonable Argument
One skill of good debating is being able to construct, and to understand, a reasoned argument and – especially important – to recognize a fallacious or fraudulent argument. The question is not whether we like the conclusion that emerges out of a train of reasoning, but whether the conclusion follows from the premises and whether those premises are true.
When developing your argument, consider the following factors:
Wherever possible offer independent confirmation of the "facts."
Prepare for substantive debate on the evidence by considering all points of view.
Arguments from authority carry little weight – "authorities" have made mistakes in the past. They will do so again in the future. Perhaps a better way to say it is that there are no authorities; at most, there are experts.
Prepare more than one case. If there's something to be defined, think of all the different ways in which it could be defined. Then think of arguments by which you might systematically rebut each of the cases. What survives, the case that resists rebuttal in this Darwinian selection among "multiple working cases," has a much better chance of being the stronger case than if you had simply run with the first idea that caught your fancy.
Try not to get overly attached to a idea just because it's yours. It's only a waystation in the pursuit of a winning argument. Ask yourself why you like the idea. Compare it fairly with the alternatives. See if you can find reasons for rejecting it. If you don't, others will.
Quantify. If whatever it is you're explaining has some measure, some numerical quantity attached to it, you'll be much better able to defend it against generalized rebuttal. What is vague and qualitative is open to many explanations. Of course there are truths to be sought in the many qualitative issues we are obliged to confront, but finding them is more challenging.
If there's a chain of argument, every link in the chain must work (including the premise) – not just most of them.
Occam's Razor. This convenient rule-of-thumb urges us when faced with two hypotheses that explain the data equally well to choose the simpler.
Always ask whether the case can be, at least in principle, falsified. Propositions that are unfalsifiable are called "truisms" and are not in the spirit of debating. You run a good chance of losing a debate, especially if the opposition correctly identifies that your arguments cannot be rebutted.

Rebuttal

Rebuttal is the process of proving that the opposing team's arguments should be accorded less weight than is claimed for them. It may consist of:
showing that the opposing argument is based on an error of fact or an erroneous interpretation of fact
showing that the opposing argument is irrelevant to the proof of the topic
showing that the opposing argument is illogical
showing that the opposing argument, while itself correct, involves unacceptable implications
showing that the opposing argument, while itself correct, should be accorded little weight

As with arguments, assertions do not equal rebuttals. Just as teams must show how and why their own arguments are valid, so they must show how and why the opposition's arguments are invalid.
An argument may be wrong in fact or logic - if so, say how and why
An argument may contradict their team line, or something else a speaker on that team has said – if so, point it out
An argument may be true but completely irrelevant – these are often called “red herrings”.

Organization of rebuttal
It is not necessary to rebutt every single point and fact raised by the opposition. Single out their main arguments and attack those first. Savage their theme line and show how it falls down – and show why yours is better! You should rebutt by both destroying the opposition's arguments and by establishing a case that directly opposes theirs.

Rebuttal O0f the Speaker

The six speakers in an Australasian Parliamentary debate each have different roles to play and adjudicators should take account of how well a speaker fulfills his/her obligations.
The first speakers establish the fundamentals of their team's cases
First Affirmative’s duties:
Defines the motion of the debate. The 1st Affirmative should ensure that no important points of definition are left out.
Presents the Affirmative’s theme line. This is normally presented in one or several lines of analysis, explaining why the Affirmative’s case is logically correct.
Outlines the Affirmative’s team split. This can be done by saying, for example: “I, as the first affirmative will deal with the philosophical base of our case, while my colleague, the second affirmative speaker, will examine its practical implications”.
Delivers substantial arguments (“1st Affirmative’s part of the split”). After establishing the definition, theme line, and team split, the 1st Affirmative should then deal with the arguments/points that have been assigned to him/her in the team split.
Provide a brief summary/recap of the speech.

The 1st Affirmative may spend some time on the definition and on establishing the theme line and showing how it is going to develop, but it is important to leave time to present some substantive arguments.
First Negative’s duties:
Provide a response to the definition (accepts or challenges the definition).
Rebutts 1st Affirmative, delivers a part of the negative's substantive case.
Presents the Negative’s theme line.
Outlines the Negative’s team split.
Delivers substantial arguments (“1st Negative’s part of the split”).
Provide a brief summary/recap of the speech.

The 1st Negative’s role is similar to the role of the 1st Affirmative’s, with the added responsibility of responding to the arguments brought up by the latter. The response to the 1st Affirmative’s arguments can come before the 1st Negative presents his/her own arguments to support the Negative’s case or vice-versa. However, the delivery of rebuttals first is recommended.
After the first speakers have spoken the main direction of each team’s case should be apparent.
The second speakers deal with the bulk of the substantive argument
Second Affirmative’s duties:
Rebutts the 1st Negative's major arguments.
Briefly restates/reiterates in general terms the Affirmative’s team case.
Delivers substantial arguments (“2nd Affirmative’s part of the split”). Most of the 2nd Affirmative's time should be spent dealing with new substantial material/arguments. He or she has the duty to present the bulk of the Affirmative's case in an attempt to further argue in favor of the Affirmative.
Provide a brief summary/recap of the speech.

The 2nd Affirmative should be prepared to defend the definition if necessary. If it is attacked, it is vital for the 2nd Affirmative to win back the initiative.
Second Negative’s duties:
Rebuttal of the first two Affirmative speakers.
Briefly restates/reiterates in general terms the Negative’s team case.
Delivers substantial arguments (“2nd Negative’s part of the split”).
Provide a brief summary/recap of the speech.

The 2nd Negative has duties similar to the one performed by the 2nd Affirmative.
Most of the teams' substantive argument should have emerged by the time both second speakers have spoken.
The third speakers main duty is to rebutt the opponent’s case
Third Affirmative’s duties:
Rebutt the points raised by the first two Negative speakers. The 3rd Affirmative is mainly entrusted with the duty of responding to the arguments of the Negative that were not previously dealt with by the first two Affirmative speakers. 3rd Affirmative may also reinforce rebuttals that have already been stated by teammates.
Rebuild team’s case (briefly reiterate theme line and first two speakers’ arguments).
Summarize the issues of the debate.

The role of the third speakers is simply this: Attack! Most of a third speaker's time must be spent rebutting the preceding speakers. Generally at least three quarters of a third speech should be rebuttal.
Rebuttal should ideally be carried out on two levels: on a global level (teamwise), a 3rd speaker should attack the opposing team’s whole case, pointing out the major flaws in argumentation and logic. On a more detailed level (speechwise), a 3rd speaker should be able to point out the mistakes in fact and inconsistency of each individual speech.
Third Negative’s duties:
Rebutt the points raised by all three Affirmative speakers.
Rebuild team’s case (briefly reiterate theme line and first two speakers’ arguments).
Identify the points of contention / the clash of the debate
Summarize the issues of the debate

The 3rd Negative has duties similar to the ones performed by the 3rd Affirmative. However, the 3rd Negative cannot introduce new matter, except for new examples to reinforce an argument that has previously been brought up. The logic behind this rule is that if a 3rd Negative is allowed to introduce new matter, the Affirmative would be at a disadvantage as they would not have any opportunity to be able to respond to these new arguments.
Reply speakers give a recap of the debate and a convincing biased adjudication
Reply speakers duties (both sides):
Provide a summary or overview of the debate
Identify the issues raised by both sides
Provide a biased adjudication of the debate

Either the first or the second speaker of each side may deliver the reply speech. The Negative team delivers the first reply speech.
A reply speech is a review of both your own and the opposition's case. It represents a chance for the teams to show their arguments in the best light and to summarize the flaws in the opposition's case. The aim is to emphasize the major points made by your own team and to show how these contributed to a logical progression of argument in support of your theme line. At the same time the flaws in the opposition's argument must be outlined. This can be done point-by-point, or by taking a more global approach to the arguments. Both are effective if well done, so find the summary style that suits you best. However, the latter style is often more effective in light of the limited time frame.
The introduction of new material is absolutely prohibited and will be penalized. Any point brought up by the other side which had not been rebutted earlier in the substantial speeches may not be rebutted in the reply speeches. Therefore, this means that all substantive arguments presented in the debate must be dealt with by the opposing team in the substantial speeches.


Adjudication

Adjudication is the process of determining which team wins the debates. This is conducted by an adjudicator, or a panel consisting of an odd number of adjudicators.
There is always a winner in a debate. There are no ‘draws’ or ‘ties’. The speakers are assessed on Matter, Manner, and Method. Matter is 40 points, Manner is 40, and Method is 20, making a total of 100 points for each substantial speech. For reply speeches, Matter and Manner are 20 points and Method is 10, making a total of 50 points.
Matter refers to the points, arguments, logic, facts, statistics, and examples brought up during the course of the debate. Manner is concerned with the style of public-speaking – the use of voice, language, eye contact, notes, gesture, stance, humor and personality as a medium for making the audience more receptive to the argument being delivered. There are no set rules which must be followed by debaters. Method consists of the effectiveness of the structure and organization of each individual speech, the effectiveness of the structure and organization of the team case as a whole, and the extent to which the team reacted appropriately to the dynamics of the debate.

Closing

This document is not intended to be the definitive set of rules that you must adhere to in debating. It serves as a source of information. For further information, please check out the Casebuilding Examples of Australasian Parliamentary Debate. It provides more in-depth explanation of cases, and gives examples to give a good idea of how one should construct cases.
Finally, it must be said that “practice makes perfect”. No one ever masters the art of swimming or riding a bicycle by thoroughly reading guidelines and handbooks. One must take that first plunge, and perhaps even fall down once or twice, before finally becoming skillful. The same applies to debating. These guidelines should be enough to get you started. But practice makes perfect.
Happy Debating!