CONTOH TIPE DATA BENTUKAN – LIVE CODE

CONTOH TIPE DATA BENTUKAN – LIVE CODE

#include<stdlib.h>
#include<stdio.h>

typedef struct
{
char nama [20];
char nim [20];
char jenkel;

}data;

data input();
void output (data sakkarepmu);
int main ()
{
data bebas;
bebas = input ();
puts (“”);
puts (“”);
output (bebas);
getch ();
}

data input ()
{
data bebas;
printf (“Nama : “);
gets (bebas.nama);
printf (“NIM : “);
gets (bebas.nim);
printf (“Jenkel (L/P) : “);
fflush(stdin);
scanf (“%c”,&bebas.jenkel);

return bebas;
}

void output (data sakkarepmu)
{
printf (“Nama : %s\n”,sakkarepmu.nama);

printf (“NIM : %s\n”,sakkarepmu.nim);

printf (“Jenkel(l/p) : %c\n”,sakkarepmu.jenkel);

}

Leave a Comment

Your email address will not be published. Required fields are marked *