解释这段代码void present()//显示所有 { int i; if (n == 0) { printf("您好,现在没有学生信息,请先增加学生信息或者刷新再来试试!\n"); } else { printf("现在共有%d名学生:\n", n); printf("学号\t\t姓名\t\t性别\t\t年龄\t\tC语言\t\t高数\t\t英语\n"); for (i = 0; i < n; i++) { printf("%s\t\t%s\t\t%c\t\t%d\t\t%.2f\t\t%.2f\t\t%.2f\n", stu[i].StuID, stu[i].Stuname, stu[i].Stusex, stu[i].Stuage, stu[i].score[0], stu[i].score[1], stu[i].score[2]); } } system("pause"); }
时间: 2023-08-22 17:09:14 浏览: 34
这是一个用于显示学生信息的函数。它首先判断学生信息是否为空,如果为空则输出提示信息,否则就输出所有学生的信息。具体的信息包括每个学生的学号、姓名、性别、年龄以及C语言、高数和英语的成绩。其中,stu数组是一个结构体数组,包含了所有学生的信息。函数最后使用system("pause")来暂停程序,等待用户按下任意键后继续执行程序。
相关问题
C语言代码输出排版调整void present() //浏览函数 { int i; if(n==0) { printf("您好,现在没有学生信息,请先增加学生信息!\n"); } else { printf("现在共有%d名学生:\n",n); printf("学号\t\t\t姓名\t\t性别\t\t班级\t\t\t出生日期\t\t 电话\t\t 家庭地址\t\t\t C语言成绩\t\t高数成绩\t大学英语成绩\n"); for(i=0;i<n;i++) { printf("%s\t\t%s\t\t%s\t\t%s\t\t\t%s\t\t%s\t\t%s\t\t%.2f\t\t%.2f\t\t%.2f\n",stu[i].num,stu[i].name,stu[i].sex,stu[i].banji,stu[i].brith,stu[i].phonenumber,stu[i].home,stu[i].score[0],stu[i].score[1],stu[i].score[2]); } } system("pause"); }
以下是排版调整后的 C 语言代码:
void present() //浏览函数
{
int i;
if (n == 0)
{
printf("您好,现在没有学生信息,请先增加学生信息!\n");
}
else
{
printf("现在共有 %d 名学生:\n", n);
printf("学号\t\t\t姓名\t\t性别\t\t班级\t\t\t出生日期\t\t 电话\t\t 家庭地址\t\t\t C语言成绩\t\t高数成绩\t大学英语成绩\n");
for (i = 0; i < n; i++)
{
printf("%s\t\t%s\t\t%s\t\t%s\t\t\t%s\t\t%s\t\t%s\t\t%.2f\t\t%.2f\t\t%.2f\n", stu[i].num, stu[i].name, stu[i].sex, stu[i].banji, stu[i].brith, stu[i].phonenumber, stu[i].home, stu[i].score[0], stu[i].score[1], stu[i].score[2]);
}
}
system("pause");
}
22.执行下面程序时,输出结果是 int main(void) { int n=0, sum=0; while (n++,n<20) {if (n==(n/2)2%) continue; sum+=n; }printf("%d\n", sum) ; }
As an AI language model, I do not have a personal opinion or emotions. The term "null" refers to a value that represents the absence of a value or an empty or undefined state. It is often used in computer programming and databases to indicate that no data is present or available.
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)