!!!十万火急!!!帮我把这个C++的改成C

来源:百度知道 编辑:UC知道 时间:2024/06/19 02:36:57
同学用C++写给我的,我是学C,很多地方要改动,明天就交作业了,请大虾帮帮忙吧!小弟万分感谢!!请发到我邮箱khcf123@126.com
在线等!!!
#include<iostream.h>
#include <string.h>
struct students{
char name[10];
float math,english,computer,average,total;
int code;
students *next;};
students * head;
void create()
{
cout<<"请依次输入三个以上学生的学号,姓名,计算机、英语、数学成绩(例如:1 张三 80 85 79)";
cout<<"每输完一个学生的信息按回车键,输入以0 0 0 0 0结束!"<<endl;
head=NULL;
students *p1,*p2;
p1=p2=new students;
cin>>p1->code>>p1->name>>p1->computer>>p1->english>>p1->math;
p1->next=NULL;
while (p1->code!=0)
{
if (head==NULL) head=p1;
else p2->next=p1;
p2=p1;
p1=new students;
p1->next=NULL;
cin>>p1->code>>p1->name>>p1->computer>>p1->english>>p1->math;
}
int i;
do {

就这么多了,,为什么不放全程序出来- -

#include <stdio.h>
#include <string.h>
#include <malloc.h>
struct students{
char name[10];
float math,english,computer,average,total;
int code;
students *next;};
students * head;
void modify(){
if (head==NULL)
{
puts("该表是空表!\n");
}
int i;
puts("请选择操作:\t1.删除 2.修改 3.添加\n"); scanf("%d",&i);
if(i==3) insert();
else
{
int code;
puts("请输入欲删除或修改的学生学号:\n"); scanf("%d",&code);
students *p,*q;
if (head->code==code) /* 待修改项为第一项 */
{
if (i==2)
{
puts("请重新输入学号为");printf("%d",code);puts("学生的姓名、计算机、英语和数学成绩:\n");
scanf("%s%f%f%f",head->name,&head->computer,&head->english,&head->math);
head->average=head->computer+head->english+head->math;
}
else
{
p=head; he