作业-10.20

1、字节对齐

#include 

struct data{
    char t1;
    char t2;
    unsigned short t3;
    unsigned long t4;
};
typedef struct Test
{
	short a; 
	struct
	{
		int b; 
		double c[10]; 
		char d; 
	};
	int e; 
}Test;
struct data1{
    char t1;
    int t2;
    short t3;
};
struct s1
{
	char c1;
	int i;
	char c2;
};

struct s2
{
	char c1;
	char c2;
	int i;
};
typedef struct Test1
{
	short a; 
	struct
	{
		int b; 
		double c; 
		char d; 
	};
	int e; 
}Test1;
int main(int argc, const char *argv[])
{
	printf("data = %ld.\n", sizeof(struct data));
	printf("data1 = %ld.\n", sizeof(struct data1));
	printf("Test = %ld.\n", sizeof(struct Test));
	printf("s1 = %ld.\n", sizeof(struct s1));
	printf("s2 = %ld.\n", sizeof(struct s2));
	printf("Test1 = %ld.\n", sizeof(struct Test1));
	return 0;
}

2、复习今天所学

作业-10.20_第1张图片

 3、大作业进度

完成了主界面的搭建。

main.c

#include 
#include 

int main(int argc, const char *argv[])
{
	while(1)
	{
		int pas;
		char name[10];
		int flag =0;
		printf("请输入用户名:");
		scanf(" %s", name);
		printf("请输入密码:");
		scanf("%d", &pas);
		int tmp= strcmp(name,"admin");

		if(!tmp&&(pas==1314))
		{
			flag = 1;
		}else
		{
			while(getchar() != '\n');
			printf("用户名或者密码错误,请重新输入!!!\n");
		}

		if(flag)
		{
			while(1)
			{
				int flag1 = 0;
				int count = 0;
				if (!flag1)
				{
					printf("----------学生的管理系统----------\n");
					putchar(10);
					printf("1、插入一个学生\n");
					printf("2、删除一个学生\n");
					printf("3、修改学生成绩\n");
					printf("4、查询学生成绩\n");
					printf("5、展示所有学生成绩\n");
					printf("6、展示排序呢后的学生成绩\n");
					printf("7、退出登录\n");
					putchar(10);
					printf("请输入要选择功能的序号:\n");
					scanf("%d", &count);
					if (count>=1 && count<=7)
					{
						if(count==7)
						{
							break;
						}
						switch(count)
						{
						case 1:
							//add_student_information();
							break;
						case 2:
							//delet_student_information();
							break;
						case 3:
							//updata_student_score();
							break;
						case 4:
							//inquire_student_score();
							break;
						case 5:
							//show_all_student_score();
							break;
						case 6:
							//sort_student_score_show();
							break;
						default:
							break;
						}
					}
					else
					{
						printf("\n----------data error----------\n");
						putchar(10);
						while(getchar() != '\n');
					}
				}
			}
			break;
		}
	}
	return 0;
}

你可能感兴趣的:(作业,c语言)