Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iostream>
- #include <string.h>
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int pil;
- char key [10];
- char s [10][10] = {"Budi", "Wawan", "Tri Wahju","Zidane", "Alif", "Sultan"};
- char daftar [25][25];
- int i;
- int limit;
- std::cout<<"Menu Pilihan = "<<endl;
- std::cout<<"1. Searching Nama"<<endl;
- std::cout<<"2. Sortir Angka"<<endl;
- std::cout<<"3. Searching Angka"<<endl;
- std::cout<<" "<<endl;
- std::cout<<"Pilih salah satu dari tiga menu!"<<endl;
- std::cout<<" "<<endl;
- std::cout<<"Pilihan Anda: ";
- std::cin>>pil;
- system("cls");
- if (pil==1)
- {
- std::cout<<"Mencari nama : ";
- std::cin>>key;
- for (i=0; i<=0; i++)
- {
- if (strcmp ( s[i] , key) == 0)
- {
- std::cout<<"Nama "<<key<<" ditemukan"<<endl;
- }
- else
- {
- std::cout<<"Nama "<<key<< " tidak ditemukan"<<endl;
- }
- }
- }
- else if (pil==2)
- {
- int arr[3];
- int n = sizeof(arr)/sizeof(arr[3]);
- sort(arr, arr+n);
- std::cout<<"Masukkan banyak angka (Maximum 3) = ";
- std::cin>>limit;
- system("cls");
- for (int x=0; x <= limit; x++)
- {
- std::cout<<"Angka ke-"<<x<<" = ";
- std::cin>>daftar[x];
- }
- for (i=0; i<=n; i++)
- {
- std::cout<<arr[i]<<" ";
- }
- }
- else if (pil==3)
- {
- std::cout<<"Masukkan banyak angka (Maximum 6) = ";
- std::cin>>limit;
- system("cls");
- for (int x=0; x <= limit; x++)
- {
- std::cout<<"Angka ke-"<<x<<" = ";
- std::cin>>daftar[x];
- }
- system("cls");
- std::cout<<"Cari data : ";
- std::cin>>key;
- system("cls");
- for (i=0; i<=0; i++)
- {
- if (strcmp ( s[i] , key) == 0)
- {
- std::cout<<"Angka "<<key<<" ditemukan"<<endl;
- }
- else
- {
- std::cout<<"Angka "<<key<< " tidak ditemukan"<<endl;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement