0% found this document useful (0 votes)
37 views6 pages

Mochammad Ganjar Nugraha 3411141140 Kelas B

This document contains the source code for a program that manages Indonesian ID card (KTP) data. It defines data types for storing an individual KTP record and a table of KTP records. The main function initializes a KTP table, provides a menu to input a KTP record, print a KTP record, or exit. It calls functions to create the table, add a record, and print a record. The record structures store fields for NIK (ID number), name, and address.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views6 pages

Mochammad Ganjar Nugraha 3411141140 Kelas B

This document contains the source code for a program that manages Indonesian ID card (KTP) data. It defines data types for storing an individual KTP record and a table of KTP records. The main function initializes a KTP table, provides a menu to input a KTP record, print a KTP record, or exit. It calls functions to create the table, add a record, and print a record. The record structures store fields for NIK (ID number), name, and address.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Mochammad Ganjar Nugraha

3411141140
Kelas B
/*

Nama : Mochammad Ganjar Nugraha

NIM: 3411141140

Kelas : B

Tugas Membuat program data Ktp

*/

#include <stdio.h>

#include <conio.h>

#include <string.h>

#define nMax 5

//TIPE BENTUKAN

typedef struct{

char NIK[19];

char nama[30];

char Alamat[15];

}Ktp;

typedef struct{

Ktp K[nMax+1];

int nEff;

}TabKtp;

//PROTOTYPE

void BuatTab(TabKtp *K);

void IsiData(TabKtp *K, char x[15]/*NIK*/,

char m[30]/*nama*/, char j[20] /*Alamat*/);


void cetakdata(TabKtp K);

//MAIN DRIVE

int main(){

//Kamus

TabKtp MyTab;

int i;

char x[15]; /*NIK*/

char m[30]; /*nama*/

char j[20]; /*ALamat*/

int menu;

//ALGORITMA

BuatTab(&MyTab);

awal:

system("cls");

printf("\n\n\n");

printf(

"\t\t==========================================\n");

printf("\t\t\tMenu Utama\n");

printf("\t\t\t==========================\n");

printf("\t\t\t 1. Input Data KTP \n");

printf("\t\t\t 2. Cetak Data KTP \n");

printf("\t\t\t 3. Keluar \n");

printf(

"\t\t==========================================\n");

printf("\t\t Pilih : "); scanf("%d",&menu);

system("cls");
switch(menu){

case 1:{

for(i=1; i<=1; i++){

printf("\n\n");

printf("\t\tINPUT DATA KTP\n");

printf("\t\t============================\n");

printf("\t\tMasukan NIK :"); scanf("%s", &x);

printf("\t\tMasukan Nama :"); scanf("%s", &m);

printf("\t\tMasukan Alamat :"); scanf("%s", &j);

printf("\n");

IsiData(&MyTab,x /*NIK*/, m /*nama*/,j/*Alamat*/);

printf("\t\tTekan spasi untuk kembali ke menu utama\n");

getch(); {goto awal;}break;

case 2 :{

BuatTab(&MyTab);

cetakdata(MyTab);

getch(); {goto awal;}break;

case 3 :{return 0;

break;

default : {goto awal;}

return 0;

}
//Body of Prototype

void BuatTab(TabKtp *K){

(*K).nEff = 0;

void IsiData(TabKtp *K, char x[7]/*NIK*/,

char m[25]/*nama*/, char j[20] /*Alamat*/){

//KAMUS

int i;

//ALGORITMA

if((*K).nEff < nMax){

(*K).nEff++;

strcpy((*K).K[(*K).nEff].NIK , x);

strcpy((*K).K[(*K).nEff].nama,m);

strcpy((*K).K[(*K).nEff].Alamat,j);

void cetakdata(TabKtp K){

//KAMUS

int i;

//ALGORITMA9

for (i=1; i<=1; i++){

printf("\n");

printf("\t\t\tKARTU HASIL STUDI\n");


printf("\t---------------------------------------------------------\n");

printf("\t| NIK : %s |\n",K.K[i].NIK);

printf("\t| Nama : %s
|\n",K.K[i].nama);

printf("\t| Alamat : %s
|\n",K.K[i].Alamat);

printf("\n\n");

You might also like