Minggu, 08 April 2012

tugas praktikum 2.2 type data struct

sintak program :



#include <iostream>
#include <string.h>
using namespace std;
int main ()
{
struct data_tanggal
{
       int tanggal;
       int bulan;
       int tahun;
};


struct data_teman
{
       char nama[50];
       struct data_tanggal tgl_lahir;
};


struct data_teman info_teman;


strcpy (info_teman.nama,"STIKOMWATI");
info_teman.tgl_lahir.tanggal = 12;
info_teman.tgl_lahir.bulan = 3;
info_teman.tgl_lahir.tahun = 1981;


cout<<"Nama : "<<info_teman.nama;
cout<<"\nTanggal lahir : "<<info_teman.tgl_lahir.tanggal
<<"-"<<info_teman.tgl_lahir.bulan
<<"-"<<info_teman.tgl_lahir.tahun;
       return 0;
}


hasil program :

Tidak ada komentar:

Posting Komentar