//13人圍成一圈,報到3退出,找到留在圈子中的人原來的序號
/*#include
#include
#include
using namespace std;
#define len sizeof(struct student)
struct student
;struct student * creat(int n)
return p1; //返回尾指標
}void print(struct student *p1)
printf("%d\n", p1->num);
}void del(struct student *p)
tmp->next = p->next;
free(p);
}int main()
else
i++;
}printf("剩餘的人的序號為:%d\n", l1->num);}*/
/*//實現鍊錶的建立,輸出,插入,刪除
#include
#include
#include
using namespace std;
#define len sizeof(struct student)
struct student
;struct student *creat()
return head;
}void print(struct student *head)
}void del(struct student *p, struct student *head)
tmp->next = p->next;
free(p);
}void in(int n, struct student *head)
tmp->next = p->next;
p->next = tmp;
}int main()
del(l1, l);
print(l);
}return0;}
*///合併兩個鍊錶,按學號排序
/*#include
#include
#include
using namespace std;
#define len sizeof(struct student)
struct student
;struct student *creat()
return head;
}void print(struct student *head)
}struct student* join(struct student *head1, struct student *head2)
t->next = g; //鏈結兩個鍊錶
int n = 1;
while(l->next != null)
//print(head1);
for(int i=0; i*m = head1;
struct student *n = m->next;
if(m->num > n->num)
m = head1;
while(m->next->next != null)
m = m->next;}}
return head1;
}int main()23
45555
7900
1926
1119300
*///刪除a鍊錶中和b相同學號的節點
#include
#include
#include
using namespace std;
#define len sizeof(struct student)
struct student
;struct student *creat()
return head;
}void print(struct student *head)
}struct student* del(struct student *head1, struct student *head2)
else
tmp->next = m->next;}}
n = n->next;
}struct student * p1=m;
m = m->next;
if(flag)
}return head1;
}int main()
課後練習題隨筆(一)
函式實現 def isodd a if isinstance a,int 判斷輸入的數是否為整數 if a 2 0 return true else return false else return false if name main while true a eval input print i...
第五章課後練習題
1.利用迴圈結構解決問題的一般步驟?答.分析需求確定迴圈條件,確定迴圈體,然後巢狀各種 就ok了。2.使用while迴圈結構輸出 100 95 90 85 5。實現程式設計。設定斷點除錯程式,觀察迴圈變數的變化。3.使用do while迴圈實現 計算1 50中是7的倍數的數值之和並輸出。4.從鍵盤接...
第三章課後練習題
第一題 根據成績輸出評分 s float input 請輸入成績 if s 90 print a elif 89 s 80 print b elif 79 s 70 print c elif 69 s 60 print d elif 60 s 0 print e else print 您輸入有誤!第...