开发工具:
文件大小: 74kb
下载次数: 0
上传时间: 2011-05-08
详细说明: 数据结构稀疏矩阵实验课程设计 /********function definition********/ int init_matrix(crosslist &one) {//initialization one.row_size=0; one.colum_size=0; one.non_zero_amount=0; one.rhead=NULL; one.chead=NULL; return OK; }//init_matrix int creat_matrix(crosslist & one) {//assignment int i;//as count in the loop element news,temp; /*input row size ,colum size and non zero amount*/ printf("Input the row size of the matrix:"); scanf("%d",&one.row_size); printf("Input the colum size of the matrix:"); scanf("%d",&one.colum_size); printf("Input the non zero amount of the matrix:"); scanf("%d",&one.non_zero_amount); /*allocate memory and the first memory not use*/ one.rhead=(element*)malloc(sizeof(element)*(one.row_size+1)); assert(one.rhead!=NULL);//assert have space one.chead=(element*)malloc(sizeof(element)*(one.colum_size+1)); assert(one.chead!=NULL); /*set all the pointer to NULL*/ for(i=1;i<=one.row_size;i++) one.rhead[i]=NULL; for(i=1;i<=one.colum_size;i++) one.chead[i]=NULL; printf("/**************************************/\n"); /*assignment*/ for(i=1;i<=one.non_zero_amount;i++) {//insert all non zero elements /*creat a new node and assign value to it*/ news=(element)malloc(sizeof(node)); assert(news!=NULL); do {//insure the row script is valid printf("Input the script of the row:"); scanf("%d",&news->row); }while(news->row>one.row_size); do {//insure the colum script is valid printf("Input the script of the colum:"); scanf("%d",&news->colum); ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.