?? yanhan.cpp
字號:
#include<string.h>
#include<ctype.h>
#include<stdio.h>
#include<graphics.h>
#include<conio.h>
#include<dos.h>
#define maxworker 100
void *buffer;
FILE *al;
FILE *fp;
struct data1{
int year;
int month;
int day;
};
struct address{
char province[10];
char city[10];
char street[20];
};
struct WORKER{
char name[20];
enum {male,female}sex;
struct data1 birthday;
enum {elesch,middle,high,university,other}rofs;
struct data1 workerday;
int workeri;
char possition[20];
struct address addr;
int workerj;
char tel[13];
};
void add(int *i,struct WORKER *profile);
enum {false,true}status;
main()
{
struct WORKER profile[maxworker];
int *i;
void add(int *i,struct WORKER *profile);
int selection;
do
{
printf("\t1.add one worker to the file\n");
printf("\t6.save new data\n");
scanf("%d",&selection);
switch(selection)
{
case 1:
add(i,profile);
printf("\n\nin function main,i=%d",i);
break;
case 6:
break;
default:
printf("please enter the correct selection!\n");
return 0;
}
}while(1);
}
void add(int *i,struct WORKER *profile)
{
char add_name[20];
printf("\n\tNow add NO.%d worker's profile\n",*i+1);
while(status == false)
{
printf("Enter the name of the worker:");
scanf("%s",add_name);
if(strlen(add_name)==0||strlen(add_name)>20)
{
status=false;puts("input error,name cannot over 8 character or less than 0character!");
continue;
}
else
status = true;
}
strcpy(profile[*i].name,add_name);
++(*i);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -