当前位置:首页 » 编程语言 » 数据结构c语言版程序
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

数据结构c语言版程序

发布时间: 2022-03-16 03:24:00

Ⅰ 数据结构(c语言版) 程序题

兄弟,问下你学的数据结构的书是什么作者的?有代码吗?适合初学者吗?

Ⅱ 求数据结构(C语言版)程序

用结构体做要好的多
时间关系简单写了下
你自己可以用结构体
做下一个建立一个删
除函数main函数一调
用完事,也节约内存
#include<stdio.h>
void main()
{
int n,i,p,q;int a[50];
printf("输入数据\n");
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
printf("输入插入数据和位置\n");
scanf("%d,%d",&p,&q);
for(i=n+1;i>q;i--)
a[i]=a[i-1];
a[q]=p;
for(i=1;i<=n+1;i++)
printf("%-2d",a[i]);
}

Ⅲ 编写 数据结构(C语言版)的软件叫什么。

数据结构(c语言版)里面的那些程序可以用VC 6.0来实现。其它C语言的编译器也可以

Ⅳ 数据结构C语言源程序

string s="jyguhttyyt";
string t="sadfwefwafwwafehrrtfdghr";
string r;
size_t i=0;
i=s.find_first_not_of(t);
while(i!=s.length()&&i!=string::npos)
{
size_t j=r.find_first_of(s[i]);
if(j==string::npos)
{
r+=string(s,i,1);
}
i=s.find_first_not_of(t,i+1);
}
cout<<r<<endl;

Ⅳ 数据结构c语言版程序设计

#include<stdio.h>
#include<string.h>
#defineMAXLEN1000
intmain()
{
unsignedlongresult=0;
intmax=1;
intcount=0;
intmin=999999;
doubleavg;

intinput;
while(1)
{
if(scanf("%d",&input))
{
if(input<0)
{
break;
}
max=max>input?max:input;
min=min<input?min:input;
result+=input;
count++;
}
else
{
//输入错误处理
}
}

avg=result*1.0/count;
printf(" 一共输入:%d 和:%d 最大值:%d 最小值:%d 平均值:%f ",count,result,max,min,avg);
}

Ⅵ 帮忙设计个程序,数据结构C语言版的。

/*
将没有头结点的链表中的字符数据分类
用三个带头结点的链表存放
*/
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
typedef struct node{
int data;
struct node *next;
}node,*list;
//输入原始字符串进无头结点的链表
list input(){
char ch;
char e;
list L=NULL,p,q;
printf("\n请输入数据(空格隔开):\n");
do{
scanf("%c",&e);
ch=getchar();
if(L==NULL){
p=(list)malloc(sizeof(node));
if(!p){
printf("\n分配空间失败\n");
exit(1);
}
p->data=e;
L=p;
}
else{
q=(list)malloc(sizeof(node));
if(!q){
printf("\n分配空间失败\n");
exit(1);
}
q->data=e;
q->next=NULL;
p->next=q;
p=q;
}
}while(ch!='\n');
return L;
}
//初始化带头结点的链表
list init(){
list L;
L=(list)malloc(sizeof(node));
if(!L){
printf("\n分配空间失败\n");
exit(1);
}
L->next=NULL;
return L;
}
//输出链表中的数据
void output(list L,int i){ //i判断链表类型
list p;
switch(i){ //无头结点
case 0:
p=L;
break;
case 1:
p=L->next; //有头结点
break;
}
do{
printf("%c",p->data);
p=p->next;
}while((p!=L&&i==1)||(p->next&&i==0));
printf("\n");
}
//把元素插到链表末端
void insert(list L,char e){
list p=L,q;
while(p->next){ //使p指向最后
p=p->next;
}
q=(list)malloc(sizeof(node));
if(!q){
printf("\n分配空间失败\n");
exit(1);
}
q->data=e;
q->next=NULL;
p->next=q;
p=q;
}
void circle(list L){
list p=L;
while(p->next){
p=p->next;
}
p->next=L;
}
void main(){
list L,L1,L2,L3;
list p;
L=input(); //存英文
L1=init(); //存数字
L2=init(); //存其他符号
L3=init();
p=L;
while(p){
if(p->data>='a'&&p->data<='z'||p->data>='A'&&p->data<='Z'){
insert(L1,p->data);
p=p->next;
}
else if(p->data>='0'&&p->data<='9'){
insert(L2,p->data);
p=p->next;
}
else{
insert(L3,p->data);
p=p->next;
}
}
circle(L1);
circle(L2);
circle(L3);
printf("\n原始数据:");
output(L,0);
printf("\n英文字符:");
output(L1,1);
printf("\n数字:");
output(L2,1);
printf("\n其他字符:");
output(L3,1);
}

Ⅶ 数据结构 c语言版 程序填充

#include <stdio.h>

#define MAXSIZE 100
#define OK 1
#define ERROR 0
#define TRUE 1
#define FALSE 0

// 学生信息
typedef struct {
char num[8]; // 学号
char name[9]; // 姓名
char gender[3];// 性别
int score; // 成绩
} STU;

// 链表结构
typedef struct node {
STU data;
struct node *next;
} ListNode,*LinkList;

// 栈结构
typedef struct
{
STU stack[MAXSIZE];
int top;
}SqStack;

// 创建链表
LinkList CreateList(int n)
{
int i;
LinkList head,p,q;

for(i=1;i<=n;i++)
{
p=(LinkList)malloc(sizeof(ListNode));
scanf("%s%s%s%d",p->data.num,p->data.name,\
p->data.gender,&p->data.score);
if(i==1) head=q=p;
else
{
q->next=p;
q=p;
}
}
q->next=NULL; // 表尾

return head;
}

// 输出链表
void PrintList(LinkList head)
{
LinkList p=head;

while(p)
{
printf("%s %s %s %d\n",p->data.num,p->data.name,\
p->data.gender,p->data.score);
p=p->next;
}
}

// 初始化栈
SqStack *InitStack(void)
{
SqStack *st=(SqStack*)malloc(sizeof(SqStack));
st->top=MAXSIZE;

return st;
}

// 压栈
int push(SqStack *st,STU stu)
{
if(st->top)
{
st->stack[--st->top]=stu;
return OK;
}
else return ERROR;
}

// 栈空
int StackEmpty(SqStack *st)
{
if(st->top==MAXSIZE)
return TRUE;
else return FALSE;
}

// 出栈
STU *pop(SqStack *st)
{

return &st->stack[st->top++];
}

// 逆置链表
void RevLinkList(LinkList head)
{
LinkList p=head;
SqStack *st=InitStack();

while(p)
{
push(st,p->data);
p=p->next;
}

p=head;
while(!StackEmpty(st))
{
p->data=*pop(st);
p=p->next;
}
}

int main(void)
{
int n;
LinkList head; // 表头

printf("输入学生个数: ");
scanf("%d",&n);
printf("请输入学生信息:\n");
head=CreateList(n);
printf("输入的学生信息如下:\n");
PrintList(head);

RevLinkList(head);
printf("逆置后学生信息:\n");
PrintList(head);

return 0;
}

稍微有些改动,对比看下。。。。

Ⅷ 求数据结构(c语言版)程序源代码

1 #include <string.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4
5 #define MAX_POS_NUM 100
6 #define MAX_STR_LEN 1024
7
8
9 //1. get all position of str_z in str_x
10 int get_sub_str_pos(const char * str_x, const char * str_z, int sub_str_pos[])
11 {
12 if (NULL == str_x || NULL == str_z)
13 {
14 printf("in error!\n");
15 return -1;
16 }
17
18 const char * pos_ptr = NULL;
19
20 pos_ptr = strstr(str_x,str_z);
21
22 int i=0;
23 while(pos_ptr)
24 {
25 printf("substring positon:%d\n",pos_ptr-str_x+1);
26 sub_str_pos[i] = pos_ptr - str_x + 1;
27 pos_ptr = strstr(pos_ptr+strlen(str_z),str_z);
28 i++;
29 }
30
31 return 0;
32 }
33
34 //2. get max length common string of str_x and str_y
35 char * get_max_com_str(const char * str_x, const char * str_y)
36 {

37 int x_len = strlen(str_x);
38 int y_len = strlen(str_y);
39
40 char * tmp_str = new char[y_len+1];
41
42 for(int i=y_len; i>0; i--) // i is substring length
43 {
44 if (i>x_len)
45 continue;
46 for(int j=0;j<=y_len-i; j++) // j is substring start postion
47 {
48 snprintf(tmp_str,i+1,"%s",str_y);
49 if (strstr(str_x,tmp_str))
50 {
51 printf("%s\n",tmp_str);
52 printf("max common substring length:%d\n",i);
53 return tmp_str;
54 }
55 }
56 }
57
58 return NULL;
59 }
60
61 //3. replace all substring in question 1
62 char * replace_sub_str(const char * str_x, char * max_com_str, int sub_str_pos[], int sub_str_len)
63 {
64 char * replaced_str = new char[MAX_STR_LEN];
65
66 int sub_pos = sub_str_pos[0];
67 int l=0; // l is sub_str_pos index
68 int i=0,j=0; //i is str_x pos, j is replaced_str pos
69
70 while(*str_x)

71 {
72 if (i==sub_pos-1) // replace from this position
73 {
74 // printf ("i:%d,\n",i);
75 for (int k=0; k<strlen(max_com_str); k++)
76 {
77 *(replaced_str + j) = * (max_com_str + k);
78 j++;
79 }
80 i += sub_str_len;
81 str_x += sub_str_len;
82 l++;
83 sub_pos = sub_str_pos[l];
84 continue;
85 }
86 *(replaced_str+j) = *str_x++;
87 i++;
88 j++;
89 }
90
91 * (replaced_str + j) = '\0';
92
93 return replaced_str;
94 }
95
96 int main()
97 {
98 const char * str_x = "abcabcabc";
99 const char * str_y = "cabcd";
100 const char * str_z = "abc";
101
102 int sub_str_pos [MAX_POS_NUM] = {0};
103
104 char * max_com_str = NULL;

105
106 char * replaced_str = NULL;
107
108 get_sub_str_pos(str_x,str_z,sub_str_pos);
109 max_com_str = get_max_com_str(str_x,str_y);
110
111 printf("max common str: %s\n",max_com_str);
112
113 replaced_str = replace_sub_str(str_x, max_com_str, sub_str_pos, strlen(str_z));
114 printf("repalced str: %s\n",replaced_str);
115
116 return 0;
117 }

Ⅸ 数据结构(C语言版)编程题

倒 题目是靠自己想的,如果你基础不好,拿别人的又有什么意思呢

Ⅹ 数据结构(c语言版)里面的那些程序是用什么工具实现的。。

数据结构(c语言版)里面的那些程序可以用VC 6.0来实现。其它C语言的编译器也可以。
ASP.net 要用来做网络编程的,要一些网络知识和一点编程的基础。
ASP的前景不如PHP和JSP,ASP不要花太多的时间去学了。