Twitter Update

Create program input biodata with struct [C]

In this section I create program with Structure, or can be called Struct, First, is definition of variable in struct, then we just use the variable like coding below, It's simple program, if there is not yet understood, just ask me :)


#include<stdio.h>
#include<conio.h>
void main()
{
    struct  {
        char firstname[20];
        char lastname[20];
        char kota[20];
        char telepon[20];
    }  a;
    printf("\n\n            [ Program untuk menginput biodata ] ");
    printf("\n\nMasukan Nama depan anda    : ");
    scanf("%s",&a.firstname);
    printf("\nMasukan Nama belakang anda : ");
    scanf("%s",&a.lastname);
    printf("\nKota anda               : ");
    scanf("%s",&a.kota);
    printf("\nNomor telepon           : ");
    scanf("%s",&a.telepon);

  
    printf("\n\nNama anda adalah %s %s.",a.firstname,a.lastname);
    printf("\nAnda tinggal di %s.",a.kota);
    printf("\nNomor telepon anda %s.",a.telepon);
    printf("\n\n");
    getch();
}

Hopefully useful ^_^

0 comments:

Post a Comment

ABOUT ME

IP
Albert Julius. Powered by Blogger.
Copyright © Albert'Blog