opoooo kui . .
pertama2ne rodo radonk [@_@]
tp ternyata lumayan 'MUDAH' . . hehe
disuruh bu dosen : INPUT, OUTPUT, CARI, EDIT, HAPUS
eh setelah dibolak - balik ni otak, nemu juga tu intinya . .
SOURCE CODE C++ :
#include <iostream>
#include <conio>
#include <conio>
void main (){
int X[100],batas,cari,edit,hapus;
awal:
cin>>batas;
if(batas>100){
cout<<"data overload . . . ";
goto awal;}
//INPUT ARRAY
for(int a=0;a<batas;a++){
cout<<"indeks ke "<<a<<" = ";
cin>>X[a];}
//PENCARIAN ARRAY
cout<<"\nsaatnya pencarian data ";
cout<<"\nmasukkan nilai = ";
cin>>cari;
for(int b=0;b<batas;b++){
if(X[b]==cari){
cout<<"data terdapat di indeks ke- "<<b<<endl;}}
//EDIT ARRAY
cout<<"\nedit data yuuk..";
cout<<"\nindeks ke = ";
cin>>edit;
cout<<"masukkan nilai baru = ";
cin>>X[edit];
cout<<"\ndata setelah diedit ";
for(int c=0;c< batas;c++)
{cout<<"\nindeks ke- "<<c<<" = "<<X[c];}
//HAPUS ARRAY
cout<<"\n\nhapus data!!!";
cout<<"\nindeks ke- = ";
cin>>hapus;
cout<<"data yang baru : ";
for(int d=hapus;d<batas;d++)
{X[d]=X[d+1];}
for (int d=0;d<batas-1;d++)
{cout<<"\nnilai ke- "<<d<<" = "<<X[d];}
getch();}
NB : maaf klo programnya agak amburadul, coz masih belajar, belum expert, hehe
0 komentar:
Posting Komentar