⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pwd-write.txt

📁 飞机票的预定系统
💻 TXT
字号:
#include <stdio.h>
typedef struct
{
	char name[10];		//姓名
	char pwd[6];		//密码
	int state;			//状态(是否管理员)(0是,1不是)
	int record;			//是否处于登陆中(1是,0不是)
	int first;			//是否首次登陆(1是)
}
emploe;			//定义员工信息
void main()
{
	FILE *f;
	int i = 0;
	char n;
	emploe p[10];
	for(i=0;i<10;i++)
	{
		printf("enter the name:");
		fflush(stdin);
		gets(p[i].name);
		printf("input the password:");
		fflush(stdin);
		gets(p[i].pwd);
		printf("input the state:");
		fflush(stdin);
		scanf("%d", &p[i].state);
		printf("input the record:");
		fflush(stdin);
		scanf("%d", &p[i].record);
		printf("input the first:");
		fflush(stdin);
		scanf("%d", &p[i].first);
		printf("\n\n\t\t第%d个信息已经输入完毕是否继续(y/n)?",i+1);
		fflush(stdin);
		scanf("%c",&n);
		switch(n)
		{
		case 'y':
		case 'Y':
			continue;
			break;
		case 'n':
		case 'N':
			//////////
			break;
		default:
			printf("您的输入有误,请重新输入!!");
		}
		break;
	}
	
	
	if ((f = fopen("pwd.dat", "w+b")) == NULL)
	{
		printf("File Can't be find!\n");
	}
	else
	{
		fwrite(&p, sizeof(emploe), 1, f);
	}
	fclose(f);
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -