A表:sno sname 001 a 002 b 003 c B表; score 90 98 98 请问如何将B表的成绩
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/10/04 22:09:01
A表:sno sname 001 a 002 b 003 c B表; score 90 98 98 请问如何将B表的成绩直接加到A表上面
楼主参考下这个程序,里面有合并两个文件的
#include
#define SIZE 1024
char buffer[SIZE];
FILE *fp1,*fp2;
double sizef,ev_sizef;
void menu123();
void divide123();
void unite123();
void unitefile123();
main()
{
menu123();
}
void menu123() /*主界面的选择菜单*/
{
int n;
/* clrscr();/*清除整个当前字符窗口,并且把光标定位于左上角(1,1)处*/
do
{
printf("\nplease choose you needful file:1.divide file 2.unite file 3.exit :");
scanf("%d",&n);
if(n==1)
divide123();
else
if(n==2)
unite123();
else
if(n==3)
exit(0);
}while(n3);
}
void unite123() /*合并文件*/
{
int n;
char name[25],c;
lp:
lp1:
printf("\nplease input unite file's postion:");
scanf("%s",name);
if((fp1=fopen(name,"wb"))==NULL)
{
printf("\nthe postion is error,whether or not repeate input(Y/N):");
getchar();
c=getchar();
if(c=='Y'||c=='y')
goto lp1;
else
menu123();
}
unitefile123();
printf("\nunitefile successful,whether or not continue to unite the other files(Y/N):");
getchar();
c=getchar();
if(c=='Y'||c=='y')
goto lp;
else
menu123();
}
void unitefile123() /*合并文件*/
{
int i=1;
char name[25],c;
do
{
lp1:
printf("\nplease input you want to uniting %d new file's postion:",i++);
scanf("%s",name);
if((fp2=fopen(name,"rb+"))==NULL)
{
printf("\nyou input the file postion is error,whether or not input the new name(Y/N):");
if(getchar()=='Y'||getchar()=='y')
goto lp1;
else
menu123();
}
while(fread(buffer,1,1,fp2))
fwrite(buffer,1,1,fp1);
fclose(fp2);
printf("\nwhether or not continue to unite(Y/press any key):");
getchar();
c=getchar();
}while(c=='y'||c=='Y');
fclose(fp1);
}
void divide123() /*分割文件*/
{
int n;
char name[25],c;
lp:
lp1:
printf("\nplease input divide file's postion:");
scanf("%s",name);
if((fp2=fopen(name,"rb"))==NULL)
{
printf("\nthe postion is error,whether or not repeate input(Y/N):");
getchar();
c=getchar();
if(c=='Y'||c=='y')
goto lp1;
else
menu123();
}
printf("\nhow many do you want to divide the file:");
lp2:
scanf("%d",&n);
if(n
#include
#define SIZE 1024
char buffer[SIZE];
FILE *fp1,*fp2;
double sizef,ev_sizef;
void menu123();
void divide123();
void unite123();
void unitefile123();
main()
{
menu123();
}
void menu123() /*主界面的选择菜单*/
{
int n;
/* clrscr();/*清除整个当前字符窗口,并且把光标定位于左上角(1,1)处*/
do
{
printf("\nplease choose you needful file:1.divide file 2.unite file 3.exit :");
scanf("%d",&n);
if(n==1)
divide123();
else
if(n==2)
unite123();
else
if(n==3)
exit(0);
}while(n3);
}
void unite123() /*合并文件*/
{
int n;
char name[25],c;
lp:
lp1:
printf("\nplease input unite file's postion:");
scanf("%s",name);
if((fp1=fopen(name,"wb"))==NULL)
{
printf("\nthe postion is error,whether or not repeate input(Y/N):");
getchar();
c=getchar();
if(c=='Y'||c=='y')
goto lp1;
else
menu123();
}
unitefile123();
printf("\nunitefile successful,whether or not continue to unite the other files(Y/N):");
getchar();
c=getchar();
if(c=='Y'||c=='y')
goto lp;
else
menu123();
}
void unitefile123() /*合并文件*/
{
int i=1;
char name[25],c;
do
{
lp1:
printf("\nplease input you want to uniting %d new file's postion:",i++);
scanf("%s",name);
if((fp2=fopen(name,"rb+"))==NULL)
{
printf("\nyou input the file postion is error,whether or not input the new name(Y/N):");
if(getchar()=='Y'||getchar()=='y')
goto lp1;
else
menu123();
}
while(fread(buffer,1,1,fp2))
fwrite(buffer,1,1,fp1);
fclose(fp2);
printf("\nwhether or not continue to unite(Y/press any key):");
getchar();
c=getchar();
}while(c=='y'||c=='Y');
fclose(fp1);
}
void divide123() /*分割文件*/
{
int n;
char name[25],c;
lp:
lp1:
printf("\nplease input divide file's postion:");
scanf("%s",name);
if((fp2=fopen(name,"rb"))==NULL)
{
printf("\nthe postion is error,whether or not repeate input(Y/N):");
getchar();
c=getchar();
if(c=='Y'||c=='y')
goto lp1;
else
menu123();
}
printf("\nhow many do you want to divide the file:");
lp2:
scanf("%d",&n);
if(n
A表:sno sname 001 a 002 b 003 c B表; score 90 98 98 请问如何将B表的成绩
return;顺序表原长度为%d\n",n);grade=score>=90?'A':(score>=60?'B':'C
有数据库 学生s(sno ,sname ,age ,sex) 成绩 sc(sno ,cno,grade) 课程 c(cn
It in witer in Hainan.A.snowing B.snows C.snow D.doesn't sno
实验中的SQL部分 学生表:Student(Sno,Sname,Ssex,Sage,Sdept) 课程
有A,B,C,D四个数,已知B+C>A+D,D>A+B,A+C=B+D.请问如何将A,B,C,D四个数从小到大顺序排列
以下可以将变量A,B值互换的是:A)A=B:B=A B)A=A+B:B=A-B:A=A-B C)A=C:C=B:B=A
Our team___ a score of 4 to 3 A won B won by C beat by
输入a,b,c,计算m.已知 m=max(a,b,c)/max(a+b,b,c)*max(a,b,b+c) 将求三个数的
_Do you know .the last score was?_106 to 98 A.how many B.whi
int a=97,b=98; printf ("%c",a,(b)); printf ("%c",(a,b));请问输出
请问老师:计算英语成绩等第(90分及以上为A;80分至90分为B;其余为C)请问如何操作呢?