Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct node{
- string nama;
- string tgl;
- int umur;
- string keluhan;
- struct node *next;
- }aha[100];
- void belakang(node *head ,node *tail, string nama , string tgl , string kel , int umur){
- node *baru, *joss;
- baru= new node;
- baru->nama=nama;
- baru->tgl=tgl;
- baru->keluhan = kel;
- baru->umur = umur;
- baru->next=NULL;
- if(tail->next==NULL){
- head->next=baru;
- tail->next=baru;
- }
- else{
- joss=head->next;
- joss->next=baru;
- head->next=baru;
- }
- }
- void cetak(node *head ,node *tail, string nama , string tgl , string kel , int umur){
- node *cetak;
- cetak = tail->next;
- while(cetak!=NULL){
- cout<<"Nama Pasien : "<<cetak->nama;
- cout<<"\nUmur Pasien : "<<cetak->umur;
- cout<<"\nKeluhan Pasien : "<<cetak->keluhan;
- cout<<"\nTanggal Pasien : "<<cetak->tgl;
- cout<<endl;
- cetak = cetak->next;
- }
- }
- int main()
- {
- node head,tail;
- head.next = NULL;
- tail.next = NULL;
- string nm , tgl , kel;
- int umur ,a=0;
- string pil = "y";
- do{
- cin.sync();
- cout<<"Masukkan Nama Pasien : ";
- getline(cin,nm);
- cin.sync();
- cout<<"\nKeluhan Pasien : ";
- getline(cin,kel);
- cin.sync();
- cout<<"\nUmur Pasien : ";
- cin>>umur;
- cin.sync();
- cout<<"\nTanggal : ";
- getline(cin,tgl);
- cin.sync();
- a++;
- cout<<"Ulang ? (y/n) : ";
- cin>>pil;
- belakang(&head,&tail,nm,tgl,kel,umur);
- }while(pil=="y");
- cetak(&head,&tail,nm,tgl,kel,umur);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement