Advertisement
toan9xpro2012

C3

Nov 11th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include "ALISTLIB.CPP"
  2. int Xoa_5(List *L){
  3.     Position p;
  4.     p = FirstList(*L);
  5.     while (p!=EndList(*L)){
  6.         if (Retrieve(p,*L)%5 == 0){
  7.             Delete_List(p,L);
  8.             p--;
  9.         }
  10.         p=Next(p,*L);
  11.     }
  12. }
  13.  
  14. int tangdan(List L){
  15.     Position p;
  16.     p = FirstList(L);
  17.     p = Next(p,L);
  18.     while (p!=EndList(L)){
  19.         if (Retrieve(p,L)<Retrieve(p-1,L)){
  20.             return false;
  21.         }
  22.         p=Next(p,L);
  23.     }
  24.     return true;
  25. }
  26.  
  27. int main(){
  28.     List Test;
  29.     Read_List(&Test);
  30.     Print_List(Test);
  31.     printf("\n");
  32.     if (tangdan(Test)){
  33.         printf("Danh sach vua nhap la tang dan");
  34.     } else {
  35.         printf("Danh sach vua nhap khong tang dan");
  36.     }
  37.     //Xoa_5(&Test);
  38.     //printf("%d",tangdan(Test));
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement