contoh script c++ membuat data buku

contoh script c++ membuat data buku

#include <cstdlib>

#include <iostream>

using namespace std;

struct databuku

{

char kodebuku[25];

char namabuku[40];

char tahunterbit[4];

char pengarang[30];

int harga;

};

int main()

{

databuku db;

cout<<"*******************************"<<endl;

cout<<"*******************************"<<endl;

cout<<"      Rahmat Agus Rusadi"<<endl;

cout<<"          2010140487"<<endl;

cout<<"*******************************"<<endl;

cout<<"*******************************"<<endl;

cout<<"Kode Buku : "; cin.getline(db.kodebuku,25);

cout<<"Nama Buku : "; cin.getline(db.namabuku,40);

cout<<"Tahun Terbit : "; cin.getline(db.tahunterbit,4);

cout<<"Pengarang : "; cin.getline(db.pengarang,30);

cout<<"Harga Buku : Rp."; cin>>db.harga;

cout<<"-------------------------------"<<endl;

cout<<"-------------------------------"<<endl;

cout<<endl;

cout<<"Kode Buku : "<<db.kodebuku<<endl;

cout<<"Nama Buku : "<<db.namabuku<<endl;

cout<<"Tahun Terbit : "<<db.tahunterbit<<endl;

cout<<"Pengarang : "<<db.pengarang<<endl;

cout<<"Harga Buku : Rp. "<<db.harga<<",-"<<endl;

cout<<"-------------------------------"<<endl;

cout<<"-------------------------------"<<endl;

system ("PAUSE");

return 0;

}

Share this:

Enter your email address to get update from Kompi Ajaib.

Tidak ada komentar