摘要: 教学任务安排系统:#include "stdlib.h"#include "stdio.h"#define MAX 100 typedef struct{ int s[MAX][MAX];//用二维数组存放教师专业特长 int D[MAX]; //用一维数组存放安排的教学任务 }MGraph;MGraph G;int creat(int *k,int n) //初始化,将二维数组s和一维数组D的adj全部赋值为0 { int i,j; for(i=1;i<=n;i++) { G.D[i]=0; ... 阅读全文
posted @ 2011-06-27 13:58 新技术 阅读(332) 评论(0) 推荐(0) 编辑
摘要: 编写自定义函数:建立一个带有头结点head的有20个结点的链表,20个结点所需数值由随机数产生。编写自定义函数:建立两个链表,把存有数据的链表中的偶数存入一个链表,奇数存入另一个链表中。编写主函数调用上述两个函数并可输出三个链表中的数据。完整的代码如下:#include "iostream"using namespace std;#include "time.h"struct node{ int data; node *next;};node *head=NULL;void InsertNode(node* &head,int value){ i 阅读全文
posted @ 2011-06-27 12:22 新技术 阅读(1504) 评论(0) 推荐(0) 编辑
摘要: C语言版本的:#include "stdio.h"#include "stdlib.h"#include "string.h"void sort(char *str[],int size){ int i,j; char *temp; for(i=0;i<size-1;i++) { for(j=i+1;j<size;j++) { if(strcmp(str[i],str[j])>0) //字符串之间的比较 { temp=str[i]; str[i]=str[j]; str[j]=temp; } } }} int mai 阅读全文
posted @ 2011-06-27 10:18 新技术 阅读(1764) 评论(0) 推荐(0) 编辑