Berikut ini coding untuk membuat program menampilkan biodata :


#include<iostream>
#include<Windows.h>

using namespace std;
void setcolor(unsigned short color){
 HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);
 SetConsoleTextAttribute(hCon, color);
}

int main(){

char tampil[5];
 char nama[50], alamat[50], tlahir[50], tKelamin[50], telp[50];
 char kerja[50], email[50], website[50];

setcolor(8);
 cout << " ======================================================================= \n";
 cout <<" DAFTAR RIWAYAT HIDUP \n";
 cout <<" ======================================================================== \n";
 cout <<"\n\n";
 setcolor(2);
 cout <<" Nama : ";
 cin.getline(nama,50);
 cout <<" Alamat : ";
 cin.getline(alamat,50);
 cout <<" Tempat tanggal lahir : ";
 cin.getline(tlahir,50);
 cout <<" Jenis Kelamin : ";
 cin.getline(tKelamin,50);
 cout <<" No Telepon : ";
 cin.getline(telp,50);
 cout <<" Pekerjaan : ";
 cin.getline(kerja,50);
 cout <<" Email : ";
 cin.getline(email,50);
 cout <<" Website : ";
 cin.getline(website,50);
 cout<<"\n\n";
 setcolor(8);
 cout<<"===========================================================================\n";
 cout<<" ~~ Terima Kasih ~~ \n";
 cin.getline(tampil,3);

system("pause");
 return 0;
}

 

output program :
output latihan

Advertisements