Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include"D:\lib\alistlib.h"
- void readList(List &L){
- MakeNull_List(&L);
- ElementType x;
- int n;
- printf("\nNhap so phan tu ds: "); scanf("%d",&n);
- for(int i=1;i<=n;i++){
- printf("\nNhap phan tu thu %d: ", i); scanf("%d",&x);
- Insert_List(x,EndList(L),&L);
- }
- }
- int Xoa5(List *L){
- int i=1;
- while(i<=(*L).Last){
- if(Retrieve(i,*L)%5==0){
- Delete_List(i,L);
- i--;
- }i++;
- }
- }
- int TangDan(List L){
- for(int i=0;i<L.Last;i++){
- if(L.Elements[i]<L.Elements[i+1]){
- return true;
- }else return false;
- }
- }
- main(){
- List L;
- readList(L);
- Print_List(L);
- if(TangDan(L))
- printf("Ds tang dan!");
- else printf("Ds khong tang !");
- Xoa5(&L);
- printf("\nDs sau khi xoa phan tu chia het cho 5: "); Xoa5(&L);Print_List(L);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement