[C语言] 关于程序子模块的问题!
/**********************修改用户姓名***************************/
void mofname(struct allstudentinfo *p_student)
{
char ch;
char *temp;
char *newtemp;
int count;
int i;
system("cls");
count=datfile(p_student); //处理文件
if(!count)
{
printf("读取数据失败,请确认已成功录入或文件数据是否损害!");
getch();
return ; //第1个 }
newtemp=(char *)malloc(20*sizeof(char)); //分配内存
temp= (char *)malloc(20*sizeof(char)); //分配内存
printf("请输入您要修改的学生姓名:");
while(gets(temp)!=NULL&&temp[0]!='\0')
{
for(i=0;i<count;i++)
{
if(strcmp(temp,p_student[i].student.name))
{
continue;
}
else
{
printf("请您输入该学生的新姓名:");
gets(newtemp);
system("cls");
printf("\a\n\n\n\n\t\t\t确定要把姓名为%s的学生修改为%s码?(y/n)",temp,newtemp);
ch=getch();
if(ch=='y'||ch=='Y')
{
strcpy(p_student[i].student.name,newtemp); //修改姓名
infofile=fopen(filename,"w+b"); //重新写入文件
for(i=0;i<count;i++)
{
if(fwrite(&p_student[i].student,sizeof(struct studentinfo),1,infofile)==1)
continue;
else
{
fclose(infofile);
printf("修改失败,返回重新操作.....");
getch();
free(temp);
free(newtemp);
system("cls");
return ; //第2个 }
}
fclose(infofile);
system("cls");
printf("\n\n\n\n\t\t\t已成功把%s修改为%s返回!",temp,newtemp);
getch();
free(temp);
free(newtemp);
system("cls");
return ; //第3个 }
}
}
printf("找不到%s的个人信息,返回重新操作!",temp);
free(temp);
getch();
system("cls");
return ; //第4个
}
printf("\n\n\n\n\t\t\t输入有误,请返回重新操作!");
getch();
free(temp);
free(newtemp);
system("cls");
return ; //第5个}
程序中第1,2,3,4,5个return 语句各代表什么意思?
void mofname(struct allstudentinfo *p_student)
{
char ch;
char *temp;
char *newtemp;
int count;
int i;
system("cls");
count=datfile(p_student); //处理文件
if(!count)
{
printf("读取数据失败,请确认已成功录入或文件数据是否损害!");
getch();
return ; //第1个 }
newtemp=(char *)malloc(20*sizeof(char)); //分配内存
temp= (char *)malloc(20*sizeof(char)); //分配内存
printf("请输入您要修改的学生姓名:");
while(gets(temp)!=NULL&&temp[0]!='\0')
{
for(i=0;i<count;i++)
{
if(strcmp(temp,p_student[i].student.name))
{
continue;
}
else
{
printf("请您输入该学生的新姓名:");
gets(newtemp);
system("cls");
printf("\a\n\n\n\n\t\t\t确定要把姓名为%s的学生修改为%s码?(y/n)",temp,newtemp);
ch=getch();
if(ch=='y'||ch=='Y')
{
strcpy(p_student[i].student.name,newtemp); //修改姓名
infofile=fopen(filename,"w+b"); //重新写入文件
for(i=0;i<count;i++)
{
if(fwrite(&p_student[i].student,sizeof(struct studentinfo),1,infofile)==1)
continue;
else
{
fclose(infofile);
printf("修改失败,返回重新操作.....");
getch();
free(temp);
free(newtemp);
system("cls");
return ; //第2个 }
}
fclose(infofile);
system("cls");
printf("\n\n\n\n\t\t\t已成功把%s修改为%s返回!",temp,newtemp);
getch();
free(temp);
free(newtemp);
system("cls");
return ; //第3个 }
}
}
printf("找不到%s的个人信息,返回重新操作!",temp);
free(temp);
getch();
system("cls");
return ; //第4个
}
printf("\n\n\n\n\t\t\t输入有误,请返回重新操作!");
getch();
free(temp);
free(newtemp);
system("cls");
return ; //第5个}
程序中第1,2,3,4,5个return 语句各代表什么意思?
...全文
相关推荐
C语言n的阶乘n!程序
C语言是一种强大的、低级别的编程语言,非常适合进行这样的计算。首先,我们需要了解C语言的基本语法。一个简单的C程序由预处理指令、函数定义和主函数组成。
git clone 子模块没下载全的问题解决
然而,在进行克隆操作时,可能会遇到子模块没有下载完全的情况,下面我们将详细介绍如何解决git clone时子模块没下载完全的问题。
c语言程序100列(学会用c语言解决生活中的问题)
在编程世界里,C语言是一门基础且强大的编程语言,它以其简洁的语法和高效的执行能力深受程序员喜爱。"C语言程序100列"是一个旨在帮助初学者掌握C语言并将其应用于实际问题解决的学习资源。
c语言程序设计
对于初学者而言,掌握这些基本概念是学习C语言的关键步骤。通过不断实践和练习,你将能够更深入地了解C语言,并利用它来解决实际问题。
c语言中!与~有什么区别?
在C语言中,`!` 和 `~` 是两个不同的操作符,它们分别代表逻辑非和按位取反。理解这两个操作符的区别是编写高效且正确的C程序的关键。首先,`!


