- 6
- 0
- 约6.88千字
- 约 20页
- 2017-10-07 发布于河南
- 举报
数据结构编程实例1990(Data structure programming example 1990)
数据结构编程实例1990(Data structure programming example 1990)
30, energy-saving, such as the analysis of the Tao Yuanming phase of doubt
Data structure programming example
1. the basic operation of the order table
#define LEN 100
Typedef struct sqlist{
Int a[LEN];
Int length;
};
Void init (struct SqList *sq) / * * / initialization
{int i;
For (i=0; iLEN; i++)
Sq-a[i]=0;
Sq-length=0;
}
Void creat (struct SqList *sq) / * * / sequence table
{int i;
Printf (please input length);
Scanf (%d, sq-length);
Printf (please, input,%d, nums\n, sq-length);
For (i=1; i=sq-length; i++)
Scanf (%d, sq-a[i]);
}
Void print (struct SqList *sq) / * * / output sequence table
{int i;
For (i=1; i=sq-length; i++)
Printf (%d, sq-a[i]);
Printf (\n);
}
Void insert (struct SqList *sq, int POS, int x) / * * / order table to insert elements
{int i;
For (i=sq-length; i=pos; i--)
Sq-a[i+1]=sq-a[i];
Sq-a[pos]=x;
Sq-length=sq-length+1;
}
Int delete (struct SqList *sq, int POS) / * * / order table delete elements
{int, I, x;
X=sq-a[pos];
For (i=pos+1; i=sq-length; i++)
Sq-a[i-1]=sq-a[i];
Sq-length=sq-length-1;
Return (x);
}
(main)
{int, position, x;
Struct SqList *list;
Struct SqList slist;
Int xz=0;
List =slist;
While (1)
{printf (1.init\n);
Printf (2.creat\n);
Printf (3.insert\n);
Printf (4.delete\n);
Printf (5.locate_value\n);
Printf (6.locate_pos\n);
Printf (7.print\n);
Printf (0.exit\n);
Printf (please input your choice);
Scanf (%d, xz);
Switch (XZ)
{case 1:init (list); break;
Case 2:creat (list); break;
Case 3:printf (pleast, input, inset, position (POS), and, value (x));
Scanf (%d%d, position, x);
If (position1||positionlist-length+1||list-length=LEN)
Printf (position error\n);
Else, insert (list, position, X);
Break;
Case 4:printf (pleast input delete position (POS));
Scanf (%d, position);
If (position1||positionlist-length||list-length==0)
Printf (position error\n);
Else
Printf (delete, position=%d, delete, data=%d\n, position, delete (list, position));
Break;;
Case 5;
Case 6;
Case 7:print (list); bre
您可能关注的文档
- 我的童年 电视节目(My childhood TV show).doc
- 我的获奖作文(My award-winning composition).doc
- 我的高中简史,上蔡二高之我不是来打酱油的(My brief history of high school, Shangcai two, I am not here to play soy sauce).doc
- 我的治喉法则(My rule of the throat).doc
- 我国粮食分布(Grain distribution in China).doc
- 戒烟趣法(Smoking cessation fun).doc
- 战国城池(Warring States city).doc
- 我的国考经历(完整版)(My national exam experience (full version)).doc
- 战国时代,官职(Office in the Warring States Period).doc
- 战国烽烟起,摆酒论诸侯--地域品牌发展浅析(In the Warring States period, feast on regional brand development of princes).doc
最近下载
- SY_T 5106-2019 石油天然气钻采设备 封隔器规范.docx VIP
- 世界著名谈判案例.docx VIP
- T_CPI 11037-2024 石油天然气钻采设备水力振荡器技术与应用规范.docx VIP
- 雪铁龙维修 手册 图DS_5LS_Owner_Book_ZH.pdf VIP
- 2025至2030药用真菌行业项目调研及市场前景预测评估报告.docx
- T_SCMES 24—2024(石油天然气钻采设备智能钻机).pdf VIP
- 财务共享模式下企业内部控制研究——以延长石油为例.docx VIP
- 财务共享延长石油集成方案.pdf VIP
- 2025《延安延长石油集团财务共享中心实施效果分析的案例报告》8200字.doc VIP
- 2025人教版音乐一年级下册全册教学设计教案.pdf
原创力文档

文档评论(0)