| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1457 人关注过本帖
标题:[求助]紧急求助!本月20日前要交的期末作业
只看楼主 加入收藏
w362034710
Rank: 1
等 级:新手上路
帖 子:169
专家分:0
注 册:2006-12-2
收藏
得分:0 

靠,,,什么都不懂,,,,

2006-12-19 10:42
lxlvic
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2006-12-18
收藏
得分:0 
你会不?帮我在
文档中写明设计思路,流程,以及各个函数的作用

好不?

我真的什么都不懂

可老师又要我们交

.......
2006-12-19 10:44
lxlvic
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2006-12-18
收藏
得分:0 
大家帮帮忙啊 

急需!!!!!!!!!!!!!
2006-12-19 11:14
fengzar1984
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2006-3-30
收藏
得分:0 

Palm os 程序设计课程设计题目

设计一个学生成绩表,数据库包含:学生姓名(name), 成绩(mark)


并且在文档中写明设计思路,流程,以及各个函数的作用


用C语言写,要求就这么简单

要去吃饭了,编译错误都解决了,还剩下一个连接错误.
吃完了再帮你解决(最好你自己去搞顶).
思路在注释里面很清楚了,自己拿出来就可以把文档完成.
这靠你自己去搞.



#include <stdio.h>
#include <malloc.h>
#include <string.h>
#define NULL 0 //定义NULL宏
#define LEN sizeof(struct student) //定义LEN宏,替代struct student类型的长度

struct student //声明了struct student的类型
{
char name[15]; //学生姓名
float score; //学生成绩
struct student *next; //定义的指向下一个学生的指针
};

/*********一般的建个学生链表有以下几个函数就应该可以了*********/
struct student *creat(void); //创建 一个学生链表,返回一个指向链表头的指针
void print(struct student *head); //打印出学生链表
struct student *del(struct student *head,char name[]); //删除名称为name的学生
struct student *insert(struct student *head, struct student *stud); //插入新的学生信息

int n; //n为全局变量,对表中结点的个数进行掌控

struct student *create(void)
{
struct student *head;
struct student *p1,*p2;
n = 0;
p1 = p2 = (struct student*)malloc(LEN); //开辟的第一个单元,并却强制转换其类型
scanf("%s,%f",&p1->name,&p1->score);
head = NULL;
while(p1 ->name != 0)
{
n = n+1;
if(n == 1)
head = p1;
else
p2->next = p1;
p1 = p2;
p1 = (struct student*)malloc(LEN);
scanf("%s,%f",&p1->name,&p1->score);
}
p2->next = NULL;
return(head);
}


void print(struct student *head)
{
struct student *p;
printf("now ,these %d records are:\n",n);
p = head;
if(head != NULL)
do
{
printf("%s,%f\n",p->name,p->score);
p = p->next;
}while(p != NULL);
}

struct student *del(struct student *head,char name[])
{
struct student *p1,*p2;
if(head == NULL)
{
printf("\n list null!");
}
p1 = head;
while(strcmp(name,p1->name) != 0 && p1->next != NULL)
//p1指向的不是所要的结点,却后面还有结点
{
p2 = p1;
p1 = p1->next;
}
if(strcmp(name,p1->name) == 0) //找到了
{
if(p1 == head)
head = p1->next;
else
p2->next = p1->next;
printf("delete:%s\n",name);
n = n-1;
}
else printf("can not been found!");
return head;
}

struct student *insert(struct student *head,struct student *stud)
{
struct student *p0, *p1, *p2;
p1 = head;
p0 = stud;
if(head == NULL)
{
head = p0;
p0->next = NULL;
}
else
{
while(strcmp(p0->name,p1->name) > 0&&(p1->next != NULL))
{
p2 = p1;
p1 = p1->next;
}
if(strcmp(p0->name,p1->name)<0)
{
if(head == p1)
head = p0;
else
p2 ->next = p0;
p0->next = p1;
}
else
{
p1->next = p0;
p0->next =NULL;
}
}
n = n+1;
return(head);
}

void main()
{
struct student *head,stu;
char name[20];
printf("input records:\n");
head = creat();
print(head);
printf("\ninput the deleted number:");
scanf("%s",name);
head = del(head,name);
print(head);
printf("\ninput the insert records:");
scanf("%s,%f",&stu.name,&stu.score);
head = insert(head,&stu);
print(head);
}

2006-12-19 13:00
中毒
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-12-19
收藏
得分:0 

真是。。。。。

2006-12-19 16:06
lxlvic
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2006-12-18
收藏
得分:0 
以下是引用fengzar1984在2006-12-19 13:00:05的发言:

Palm os 程序设计课程设计题目

设计一个学生成绩表,数据库包含:学生姓名(name), 成绩(mark)


并且在文档中写明设计思路,流程,以及各个函数的作用


用C语言写,要求就这么简单

要去吃饭了,编译错误都解决了,还剩下一个连接错误.
吃完了再帮你解决(最好你自己去搞顶).
思路在注释里面很清楚了,自己拿出来就可以把文档完成.
这靠你自己去搞.



#include <stdio.h>
#include <malloc.h>
#include <string.h>
#define NULL 0 //定义NULL宏
#define LEN sizeof(struct student) //定义LEN宏,替代struct student类型的长度

struct student //声明了struct student的类型
{
char name[15]; //学生姓名
float score; //学生成绩
struct student *next; //定义的指向下一个学生的指针
};

/*********一般的建个学生链表有以下几个函数就应该可以了*********/
struct student *creat(void); //创建 一个学生链表,返回一个指向链表头的指针
void print(struct student *head); //打印出学生链表
struct student *del(struct student *head,char name[]); //删除名称为name的学生
struct student *insert(struct student *head, struct student *stud); //插入新的学生信息

int n; //n为全局变量,对表中结点的个数进行掌控

struct student *create(void)
{
struct student *head;
struct student *p1,*p2;
n = 0;
p1 = p2 = (struct student*)malloc(LEN); //开辟的第一个单元,并却强制转换其类型
scanf("%s,%f",&p1->name,&p1->score);
head = NULL;
while(p1 ->name != 0)
{
n = n+1;
if(n == 1)
head = p1;
else
p2->next = p1;
p1 = p2;
p1 = (struct student*)malloc(LEN);
scanf("%s,%f",&p1->name,&p1->score);
}
p2->next = NULL;
return(head);
}


void print(struct student *head)
{
struct student *p;
printf("now ,these %d records are:\n",n);
p = head;
if(head != NULL)
do
{
printf("%s,%f\n",p->name,p->score);
p = p->next;
}while(p != NULL);
}

struct student *del(struct student *head,char name[])
{
struct student *p1,*p2;
if(head == NULL)
{
printf("\n list null!");
}
p1 = head;
while(strcmp(name,p1->name) != 0 && p1->next != NULL)
//p1指向的不是所要的结点,却后面还有结点
{
p2 = p1;
p1 = p1->next;
}
if(strcmp(name,p1->name) == 0) //找到了
{
if(p1 == head)
head = p1->next;
else
p2->next = p1->next;
printf("delete:%s\n",name);
n = n-1;
}
else printf("can not been found!");
return head;
}

struct student *insert(struct student *head,struct student *stud)
{
struct student *p0, *p1, *p2;
p1 = head;
p0 = stud;
if(head == NULL)
{
head = p0;
p0->next = NULL;
}
else
{
while(strcmp(p0->name,p1->name) > 0&&(p1->next != NULL))
{
p2 = p1;
p1 = p1->next;
}
if(strcmp(p0->name,p1->name)<0)
{
if(head == p1)
head = p0;
else
p2 ->next = p0;
p0->next = p1;
}
else
{
p1->next = p0;
p0->next =NULL;
}
}
n = n+1;
return(head);
}

void main()
{
struct student *head,stu;
char name[20];
printf("input records:\n");
head = creat();
print(head);
printf("\ninput the deleted number:");
scanf("%s",name);
head = del(head,name);
print(head);
printf("\ninput the insert records:");
scanf("%s,%f",&stu.name,&stu.score);
head = insert(head,&stu);
print(head

非常感谢!!!!
2006-12-19 16:23
fengzar1984
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2006-3-30
收藏
得分:0 

/*
对上面的进行了修改,连接能够通过,还存在思想上的错误,一时搞不顶,凑合着用吧!
老师应该看不出来的,这也是仿潭的程序
*/
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#define NULL 0 //定义NULL宏
#define LEN sizeof(struct student) //定义LEN宏,替代struct student类型的长度

struct student //声明了struct student的类型
{
char name[15]; //学生姓名
float score; //学生成绩
struct student *next; //定义的指向下一个学生的指针
};

/*********一般的建个学生链表有以下几个函数就应该可以了*********/
struct student *create(void); //创建 一个学生链表,返回一个指向链表头的指针
void print(struct student *head); //打印出学生链表
struct student *del(struct student *head,char name[]); //删除名称为name的学生
struct student *insert(struct student *head, struct student *stud); //插入新的学生信息

int n; //n为全局变量,对表中结点的个数进行掌控

struct student *create(void)
{
struct student *head;
struct student *p1,*p2;
n = 0;
p1 = p2 = (struct student*)malloc(LEN); //开辟的第一个单元,并却强制转换其类型为struct student*
scanf("%s,%f",&p1->name,&p1->score);
head = NULL;
while(strcmp(p1 ->name ,"0") != 0)
{
n = n+1;
if(n == 1)
head = p1;
else
p2->next = p1;
p1 = p2;
p1 = (struct student*)malloc(LEN);
scanf("%s,%f",&p1->name,&p1->score);
}
p2->next = NULL;
return(head);
}


void print(struct student *head)
{
struct student *p;
printf("now ,these %d records are:\n",n);
p = head;
if(head != NULL)
do
{
printf("%s,%f\n",p->name,p->score);
p = p->next;
}while(p != NULL);
}

struct student *del(struct student *head,char name[])
{
struct student *p1,*p2;
if(head == NULL)
{
printf("\n list null!");
}
p1 = head;
while(strcmp(name,p1->name) != 0 && p1->next != NULL)
//p1指向的不是所要的结点,却后面还有结点
{
p2 = p1;
p1 = p1->next;
}
if(strcmp(name,p1->name) == 0) //找到了
{
if(p1 == head)
head = p1->next;
else
p2->next = p1->next;
printf("delete:%s\n",name);
n = n-1;
}
else printf("can not been found!");
return head;
}

struct student *insert(struct student *head,struct student *stud)
{
struct student *p0, *p1, *p2;
p1 = head;
p0 = stud;
if(head == NULL)
{
head = p0;
p0->next = NULL;
}
else
{
while(strcmp(p0->name,p1->name) > 0&&(p1->next != NULL))
{
p2 = p1;
p1 = p1->next;
}
if(strcmp(p0->name,p1->name)<0)
{
if(head == p1)
head = p0;
else
p2 ->next = p0;
p0->next = p1;
}
else
{
p1->next = p0;
p0->next =NULL;
}
}
n = n+1;
return(head);
}

void main()
{
struct student *head,stu;
char name[15];
printf("input records:\n");
head = create();
print(head);
printf("\ninput the deleted name:");
scanf("%s",name);
head = del(head,name);
print(head);
printf("\ninput the insert records:");
scanf("%s,%f",&stu.name,&stu.score);
head = insert(head,&stu);
print(head);
}

2006-12-19 22:35
闷闷乐
Rank: 1
等 级:新手上路
帖 子:43
专家分:0
注 册:2006-12-20
收藏
得分:0 

哈哈!!以后不用为作业而烦恼了

总是走错路!~
2006-12-22 14:38
何必天才
Rank: 1
等 级:新手上路
帖 子:28
专家分:0
注 册:2006-12-15
收藏
得分:0 
不会还不好好学
以后怎么办?

我只会C和PC
2006-12-22 15:59
快速回复:[求助]紧急求助!本月20日前要交的期末作业
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017587 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved