Petunjuk soal :
Jangan lupa tulis nim dan nama pada lembar jawaban anda.
Kerjakan di aplikasi pengolah kata (word) yang disediakan
Jawab
Program :
#include <iostream>
struct data{
string kodebrg;
string namabrg;
int hrgbrg;
data *next;
};
cur = head;
int nomor = 1;
while ( nomor < posisi - 1)
{
cur = cur->next;
nomor++;
}
newnode->next = cur->next;
cur->next = newnode;
change("12345","headset",100,3);
print(3);
#include <iostream>
data *next;
};
cur = head;
int nomor = 1;
while ( nomor < posisi - 1)
{
cur = cur->next;
nomor++;
}
newnode->next = cur->next;
cur->next = newnode;
}
before->next = cur;
delete del;
}
void printAll(){
cur = head;
while(cur != NULL){
cout<< "Kode Barang : "<< cur->kodebrg <<endl;
cout<< "nama Barang : "<< cur->namabrg <<endl;
cout<< "harga Barang : "<< cur->hrgbrg <<endl;
cout<<endl;
cur = cur->next;
}
}
int main(){
create("001","mouse",150);
add("002","keyboard",900,2);
add("003","headset",100,3);
add("004","ssd",500,4);
add("005","charger",50,5);
change("12345","headset",100,3);
remove(2);
cout<<"-----------Tampilan Data--------------"<<endl;
printAll();
cout<<"--------------------------------------"<<endl;
}
#include <iostream>
int fibo[n+1];
fibo[0] = 0, fibo[1] = 1;
int main(){
int n = 9;
cout<<"Hasil Penjumlahan "<<n<<" bilangan fibonachi pertama =
"<<penjumlahan(n)<<endl;
return 0;
}