Sabtu, 22 Juni 2013

0 Tugas Struktur Data Seksi 11

/*nim : 200981033
  nama : doni saiful bahri
  praktek struktur data seksi 11*/


struct mhs{
 char nim[10];
 char nama[30];
 };

int validasi(struct mhs *data , int n, char nim[])
{int x,found=0;
 for (x=0;x
 {if (strcmp(data[x].nim,nim) == 0 )
            { found = 1;
              break;
            }
 }
  return found;
}
 
void main ()
{
 int x,valid,pilih,jml;
 char temp[10],mau;
 struct mhs *data;
 clrscr();
 do {
 cout<<"1. input data\n2. tampil data\n3. sorting data\n4. cari data\n5. keluar\n";
 cout<<"INPUT PILIHAN ANDA[1-4] : ";
 cin>>pilih;
 if (pilih == 5)
  {break;}
 switch (pilih)
  {case 1 : do {
                                                                        clrscr();
                                                                        cout<<"input banyak data[1-50] : ";
                                                                        cin>>jml;
                                                            }
                                                            while (jml<1 jml=""> 50);
                                                            data = new struct mhs[jml];
                                                            for (x=0;x
                                                            {do {
                                                             cout<<"input data ke-"<<(x+1)<<" :\n";
                                                             cout<<"nim : "; gets(temp);
                                                             valid = validasi(data,x,temp);
                                                                         }
                                                             while (valid==1);
                                                             strcpy (data[x].nim,temp);
                                                             cout<<"nama : "; gets(data[x].nama);
                                                            }
                                                            break;
 
            case 2 : clrscr();
                                                 cout<<"\nDAFTAR MAHASISWA\n";
                                                 cout<<"NO\tNIM\t\tNAMA\n";
                                                 for (x=0;x
                                                 {cout<<(x+1)<<"\t"<
                                                  cout<<"\t"<
                                                 }
                                                 break;
             }

             cout<<"\nTEKAN Y UNTUK KEMBALI KE MENU : ";
             mau = toupper(getch());
             clrscr();
             }
             while (mau == 'Y');
}

About the Author

I'm Author description here. Go to Blogger edit html and find these sentences. Now replace these sentences with your own descriptions. Subscribe to Our Feed and Follow Me on Twitter My user

    Other Recommended Posts

0 komentar:

Posting Komentar

 
back to top