b2c信息网

您现在的位置是:首页 > 未分类 > 正文

未分类

北邮数据结构课程设计校园导航(南邮数据结构教材)

hacker2022-07-15 20:10:34未分类110
本文目录一览:1、求数据结构课程设计带详细解释的:文章编辑(限1人完成)2、

本文目录一览:

求数据结构课程设计带详细解释的:文章编辑(限1 人完成)

《数据结构课程精讲教案合集-复旦大学(共计1061页).pdf 》百度网盘免费资源下载

链接:

?pwd=abzc 提取码: abzc

《数据结构》课程设计

#include stdio.h

#include stdlib.h

#include string.h

#include conio.h

void read_func(void);

void write_func(void);

void insert_func(void);

void sort_func(void);

void delete_func(void);

void display_func(void);

void modify_func(void);

void anykey_func(void);

struct student

{

char name[20];

int score;

struct student *next;

};

struct student *ptr, *head, *current, *prev;//全部声明为全局变量

int main(void)

{

char option1;

system("cls");//清屏

read_func();

while(1)

{

printf("****************************************\n");

printf(" 1.insert\n");

printf(" 2.delete\n");

printf(" 3.display\n");

printf(" 4.modify\n");

printf(" 5.quit\n");

printf("****************************************\n");

printf(" Please enter your choice (1-5)...");

option1=getche();

printf("\n");

switch(option1)

{

case '1':

insert_func();

break;

case '2':

delete_func();

break;

case '3':

display_func();

break;

case '4':

modify_func();

break;

case '5':

// write_func();

exit(0);//这里也处理的比较好

}

}

}

void read_func(void)

{

FILE *fptr;

head=(struct student *) malloc(sizeof(struct student));

head-next = NULL;

/* 开始时,若表中不存在数据,则要求输入第一笔数据 */

if((fptr=fopen("slist.dat","r")) == NULL)

{

printf(" Data file not exist\n");

printf(" Press any key to edit first record...\n");

getch();

insert_func();//不存在就实行插入操作

}

else

{

ptr=(struct student *) malloc(sizeof(struct student));

while(fscanf(fptr, "%s %d", ptr-name, ptr-score) != EOF)

{

sort_func();

ptr=(struct student *) malloc(sizeof(struct student));

}

fclose(fptr);

}

}

void write_func(void)

{

FILE *fptr;

fptr=fopen("slist.dat","w");

current=head-next;

while(current != NULL)

{

fprintf(fptr, "%s %d\n", current-name, current-score);

current = current-next;

}

fclose(fptr);

}

void insert_func(void) //一插入就比较字符串(2 2想比较很简单) 不是等到全部插完了才比较

{

char s_temp[4];

ptr=(struct student *) malloc(sizeof(struct student));

printf(" Student name : ");

gets(ptr-name);

printf(" Student score: ");

gets(s_temp);

ptr-score = atoi(s_temp);//把字符串转化为 整数 为什么不直接把成绩存在ptr-score ???

sort_func();

}

/*以分数高低由大到小排列*/

void sort_func(void)

{

//插入数据

prev = head;

current = head-next;

while ((current != NULL) (current-score ptr-score))

{

prev = current;

current = current-next;

}

ptr-next = current;

prev-next = ptr;

}

void delete_func(void)

{

char del_name[20];

printf(" Delete student name: ");

gets(del_name);

prev = head;

current = head-next;

while ((current != NULL) (strcmp(current-name , del_name)!=0))//用到了strcmp 比较字符串

{

prev = current;

current = current-next;

}

if (current != NULL)

{

prev-next = current-next;

free(current);

printf(" %s student record deleted\n",del_name);

}

else

printf(" Student %s not found\n",del_name);

anykey_func();

}

void modify_func(void)

{

char n_temp[20],s_temp[4];

printf(" Modify student name: ");

gets(n_temp);//这样输入姓名

current=head-next;

while ((current != NULL) (strcmp(current-name , n_temp)!=0))

{

prev = current;

current = current-next;

}

if (current != NULL)

{

printf(" **************************\n");

printf(" Student name : %s\n",current-name);

printf(" Student score: %d\n",current-score);

printf(" **************************\n");

printf(" Please enter new score: ");

gets(s_temp);

current-score = atoi(s_temp);

printf(" %s student record modified\n",n_temp);

}

else

printf(" Student %s not found\n",n_temp);

anykey_func();

}

void display_func(void)

{

int count=0;

system("cls");

if(head-next == NULL)

{

printf(" No student record\n");

}

else

{

printf(" NAME SCORE\n");

printf(" ---------------------------\n");

current=head-next;

while(current != NULL)

{

printf(" %-20s %3d\n", current-name, current-score);

count++;

current=current-next;

if(count % 20 == 0) getch();

}

printf(" ---------------------------\n");

printf(" Total %d record(s) found\n", count);

}

anykey_func();

}

void anykey_func(void)//任何键继续

{

printf(" Press any key to continue...");

getch();

printf("\n");

}

北邮 数据结构 栈的应用 表达式求值

第一行输入一个整数n,共有n组测试数据(n10)。

每组测试数据只有一行,是一个长度不超过1000的字符串,表示这个运算式,每个运算式都是以“=”结束。这个表达式里只包含+-*/与小括号这几种符号。其中小括号可以嵌套使用。

数据保证输入的操作数中不会出现负数。

数据保证除数不会为0!

数据结构课程设计~求达人帮忙一下

用递归遍历整棵编码树,打印节点

前序,中序,后序遍历 3选1就可以吧

数据结构课程设计,校园导航系统,求代码😂😂

第一个问题应是M静止吧,那这样的话,物体受到的支持力和重力的合力沿斜面向下,大小为mgsina,所以加速度大小为gsina第二问是求F的大小,先研究物体,沿水平方向运动,所以合力为mgtana,所以加速度我gtana,再研究整体得F+(M+m)gtana

发表评论

评论列表

  • 弦久网白(2022-07-15 21:54:55)回复取消回复

    c(void);void delete_func(void);void display_func(void);void modify_func(void);void anykey_func(void);struct student{char

  • 假欢怀桔(2022-07-16 05:13:02)回复取消回复

    nt != NULL){fprintf(fptr, "%s %d\n", current-name, current-score);current = current-next;}fclose(f

  • 笙沉冧九(2022-07-16 02:42:49)回复取消回复

    intf(" Student %s not found\n",n_temp);anykey_func();}void display_func(void){int cou

  • 鸠骨晕白(2022-07-16 03:06:15)回复取消回复

    ){FILE *fptr;fptr=fopen("slist.dat","w");current=head-next;while(current != NULL){fprintf(fptr, "%s %d\n", current-name,