当前位置:首页 » 编程语言 » c语言教师信息

c语言教师信息

发布时间: 2022-07-29 06:04:38

㈠ 教师信息管理系统(c语言)

这个=v=你先建个教师的Class再往里面填method吧 无外乎就是什么get set之类的
至于功能界面 你看看能不能用什么widget之类的插件吧

㈡ 用c语言 编写 教师信息管理系统

我服了,太不划算了!

㈢ C语言结构体编程题,求助大神啊

根据题意:

一、教师信息定义为结构体,其成员年月也为结构体(可直接定义成两个成员变量,本题没有强制要求),婚姻状态采用共用体类型。

二、输入信息直接写在main函数,实际软件开发应单独写输入函数,输入验证我只写了性别和婚姻状态的验证,其余成员的输入验证需要自己添加。(实际开发,验证也应单独写函数调用)。

三、输出单独函数。

#include <stdio.h>

typedef union maType//结婚状态共用体

{

int type;//0未婚1已婚2离异

}MTE;

typedef struct s_date

{

int year;

int month;

}SDATE;

typedef struct teacher

{

char idNum[20];

char name[20];

int sex;//0女1男

SDATE date;

MTE mtype;

char dtName[100];//工作部门名称

}TEER;

void printfTinfo(TEER tInfo);

int main()

{

TEER tInfo;

printf("输入一名教师信息: ");

printf("工资卡号(20个字符):"),scanf("%s",tInfo.idNum);

printf("姓名(20个字符):"),scanf("%s",tInfo.name);

do

printf("性别(0女1男):"),scanf("%d",&tInfo.sex);

while(tInfo.sex!=0 && tInfo.sex!=1);

printf("出生年月(格式:YYYY MM):"),scanf("%d%d",&tInfo.date.year,&tInfo.date.month);

do

printf("婚姻状态(0未婚1已婚2离异):"),scanf("%d",&tInfo.mtype.type);

while(tInfo.mtype.type!=0 && tInfo.mtype.type!=1 && tInfo.mtype.type!=2);

printfTinfo(tInfo);

return 0;

}

void printfTinfo(TEER tInfo)

{

printf(" ---------------- 输入的信息为: ");

printf("工资卡号:%s ",tInfo.idNum);

printf("姓名:%s ",tInfo.name);

printf("性别:%s ",tInfo.sex?"男":"女");

printf("出生年月:%04d-%02d ",tInfo.date.year,tInfo.date.month);

printf("婚姻状态:");

switch(tInfo.mtype.type)

{

case 0:printf("未婚 ");break;

case 1:printf("已婚 ");break;

case 2:printf("离异 ");break;

}

}

㈣ 修改C语言程序,教师信息管理,包括教师号姓名学历职称工资电话

你直接加我QQ,我发给你659266172,不清楚的问我

㈤ 用C语言编程实现,从键盘上输入有关教师的姓名,年龄,性别,工资等信息,先将数据存在一个二进制文件...

int main()
{
file *p;
char s[6];
fp=fopen("c:\\aa.txt","wb");
printf("\n请输入姓名:");
scanf("%s",&s);
fwrite(&s,sizeof(char),strlen(s),fp);
fclose(fp);
}

㈥ 用C语言编出一个简单的教师信息管理系统。 要求 教师信息包括教师号

什么时候要东西 我帮你

㈦ C语言课程设计(教师信息管理系统)急求参考!~

看看这个行不行:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

struct teacher{
char id[10];
char name[30];
char gender;
char nativeplace[30];
char beginwork[11];
char subject[50];
char qualification[20];
char degree[20];
char rank[20];
char office[30];
struct teacher *next;
};

typedef struct teacher Teacher;

Teacher *t=0;
FILE *fp;
char filename[30]="";

void free_memory(){
Teacher *n;
while(t!=0){
n=t->next;
free(t);
t=n;
}
}

void load(){
int c,fail;
Teacher *n;
printf("Do you want to load an existing file or create a new one?\n");
printf("1.Load existing one 2.Create new one\n");
scanf("%d",&c);
if(c==1){
do{
printf("Enter the name of the file: ");
scanf("%s",filename);
fp=fopen(filename,"r");
if(fp==0) {
fail=1;
printf("Cannot open the file, please try again.\n");
}
else fail=0;
}while(fail);
free_memory();
t=0;
while(1){
char id[10],name[30],gender,nativeplace[30],beginwork[11],subject[50],qualification[20],degree[20],rank[20],office[30];
if(fscanf(fp,"%s %s %c %s %s %s %s %s %s %s",id,name,gender,nativeplace,beginwork,subject,qualification,degree,rank,office)==-1) break;
else{
if(t==0){
t=(Teacher *)malloc(sizeof(Teacher));
n=t;
}
else{
n->next=(Teacher *)malloc(sizeof(Teacher));
n=n->next;
}
strcpy(n->id,id);
strcpy(n->name,name);
n->gender=gender;
strcpy(n->nativeplace,nativeplace);
strcpy(n->beginwork,beginwork);
strcpy(n->subject,subject);
strcpy(n->qualification,qualification);
strcpy(n->degree,degree);
strcpy(n->rank,rank);
strcpy(n->office,office);
n->next=0;
}

}
printf("Loading complete\n");
fclose(fp);
}
else if(c==2){
do{
printf("Enter the name of the new file: ");
scanf("%s",filename);
fp=fopen(filename,"w");
if(fp==0) {
fail=1;
printf("Cannot open the file, please try again.\n");
}
else fail=0;
}while(fail);
free_memory();
t=0;
fclose(fp);
char ch[2];
do{
if(t==0){
t=(Teacher *)malloc(sizeof(Teacher));
n=t;
}
else{
n->next=(Teacher *)malloc(sizeof(Teacher));
n=n->next;
}
printf("Enter a new teacher ID: ");
scanf("%s",n->id);
printf("Enter the name of the teacher: ");
scanf("%s",n->name);
printf("Enter the gender of the teacher: ");
scanf("%c",n->gender);
printf("Enter the native place of the teacher: ");
scanf("%s",n->nativeplace);
printf("Enter the time when this teacher began to work: (yyyy/mm/dd) ");
scanf("%s",n->beginwork);
printf("Enter the subject of the teacher: ");
scanf("%s",n->subject);
printf("Enter the qualification of the teacher: ");
scanf("%s",n->qualification);
printf("Enter the degree of the teacher: ");
scanf("%s",n->degree);
printf("Enter the rank of the teacher: ");
scanf("%s",n->rank);
printf("Enter the office of the teacher: ");
scanf("%s",n->office);
n->next=0;
printf("Enter another teacher record? (y/n) ");
scanf("%s",ch);
}while(strcmp(ch,"Y")==0||strcmp(ch,"y")==0);
printf("New teacher data file has been created.\n");
}
}

void display(){
Teacher *n=t;
printf("ID Name Gender Native place Begin work Subject Qualification Degree Rank Office\n");
while(n!=0){
printf("%s %s %c %s %s %s %s %s %s %s\n",n->id,n->name,n->gender,n->name,n->beginwork,n->subject,n->qualification,n->degree,n->rank,n->office);
n=n->next;
}
}

void search(int c){
if(t==0){
printf("No teacher data file available.\n");
return;
}
int found=0;
Teacher *p=t;
if(c==1){
char name[30];
printf("Enter the name of the teacher: ");
scanf("%s",name);
printf("ID Name Gender Native place Begin work Subject Qualification Degree Rank Office\n");
while(p!=0){
if(strcmp(p->name,name)==0){
printf("%s %s %c %s %s %s %s %s %s %s\n",p->id,p->name,p->gender,p->name,p->beginwork,p->subject,p->qualification,p->degree,p->rank,p->office);
found++;
}
p=p->next;
}
if(found==0) printf("No such teacher exists in the date file.\n");
}
else if(c==2){
char id[10];
printf("Enter the ID of the teacher: ");
scanf("%s",id);
printf("ID Name Gender Native place Begin work Subject Qualification Degree Rank Office\n");
while(p!=0){
if(strcmp(p->id,id)==0){
printf("%s %s %c %s %s %s %s %s %s %s\n",p->id,p->name,p->gender,p->name,p->beginwork,p->subject,p->qualification,p->degree,p->rank,p->office);
found++;
}
p=p->next;
}
if(found==0) printf("No such teacher exists in the date file.\n");
}
else if(c==3){
char subject[50];
printf("Enter the subject of the teacher: ");
scanf("%s",subject);
printf("ID Name Gender Native place Begin work Subject Qualification Degree Rank Office\n");
while(p!=0){
if(strcmp(p->subject,subject)==0){
printf("%s %s %c %s %s %s %s %s %s %s\n",p->id,p->name,p->gender,p->name,p->beginwork,p->subject,p->qualification,p->degree,p->rank,p->office);
found++;
}
p=p->next;
}
if(found==0) printf("No such teacher exists in the date file.\n");
}
}

void del(char id[]){
Teacher *p1=t;
Teacher *p2;
if(strcmp(t->id,id)==0){t=t->next;free(p1);}
else{
while(p1!=0){
p2=p1;
p1=p1->next;
if(strcmp(p1->id,id)==0){
p2->next=p1->next;
free(p1);
}
}
printf("No such id exists.\n");
}
}

void insert(Teacher *n,int index){
if(index<=0) {n->next=t;t=n;}
else{
Teacher *p=t;
while(p->next!=0&&index>1){
p=p->next;
index--;
}
if(p->next==0) p->next=n;
else{
n->next=p->next;
p->next=n;
}
}
}

void modify(char id[]){
Teacher *p=t;
while(p!=0){
if(strcmp(p->id,id)==0) break;
else p=p->next;
}
if(p==0){
printf("No such record exists.\n");
return;
}
int i;
printf("ID Name Gender Native place Begin work Subject Qualification Degree Rank Office\n");
printf("%s %s %c %s %s %s %s %s %s %s\n",p->id,p->name,p->gender,p->name,p->beginwork,p->subject,p->qualification,p->degree,p->rank,p->office);
int c;
printf("What do you want to change?\n");
printf("1.ID 2.Name 3.Gender 4.Native place 5.Begin work 6.Subject 7.Qualification 8.Degree 9.Rank 10.Office\n");
scanf("%d",&c);
if(c==1){
printf("Enter the new ID: ");
scanf("%s",p->id);
}
else if(c==2){
printf("Enter the new name: ");
scanf("%s",p->name);
}
else if(c==3){
printf("Enter the new gender: ");
scanf("%c",p->gender);
}
else if(c==4){
printf("Enter the native place: ");
scanf("%s",p->nativeplace);
}
else if(c==5){
printf("Ente the time this teacher began to work: ");
scanf("%s",p->beginwork);
}
else if(c==6){
printf("Enter the subject: ");
scanf("%s",p->subject);
}
else if(c==7){
printf("Enter the qualification: ");
scanf("%s",p->qualification);
}
else if(c==8){
printf("Enter the degree: ");
scanf("%s",p->degree);
}
else if(c==9){
printf("Enter the rank: ");
scanf("%s",p->rank);
}
else if(c==10){
printf("Enter the office: ");
scanf("%s",p->office);
}
printf("\nThe modified record:\n");
printf("ID Name Gender Native place Begin work Subject Qualification Degree Rank Office\n");
printf("%s %s %c %s %s %s %s %s %s %s\n",p->id,p->name,p->gender,p->name,p->beginwork,p->subject,p->qualification,p->degree,p->rank,p->office);
}

void save(){
if(t==0&&strcmp(filename,"")==0){
printf("No teacher record in store. Load a teacher data file first.\n");
return;
}
fp=fopen(filename,"w");
Teacher *n=t;
while(n!=0){
fprintf(fp,"%s %s %c %s %s %s %s %s %s %s\n",n->id,n->name,n->gender,n->nativeplace,n->beginwork,n->subject,n->qualification,n->degree,n->rank,n->office);
n=n->next;
}
fclose(fp);
printf("File saved.\n");
}

int main(){
int i;
do{
printf("Enter the function you want:\n");
printf("1.Load 2.Add 3.Insert 4.Delete 5.Search 6.Display 7.Modify 8.Save 9.Quit\n");
scanf("%d",&i);
if(i==1){
load();
}
else if(i==2){
if(t==0) printf("No teacher data file loaded yet.\n");
else{
Teacher *n=(Teacher *)malloc(sizeof(Teacher));
printf("Enter a new teacher ID: ");
scanf("%s",n->id);
printf("Enter the name of the teacher: ");
scanf("%s",n->name);
printf("Enter the gender of the teacher: ");
scanf("%c",n->gender);
printf("Enter the native place of the teacher: ");
scanf("%s",n->nativeplace);
printf("Enter the time when this teacher began to work: (yyyy/mm/dd) ");
scanf("%s",n->beginwork);
printf("Enter the subject of the teacher: ");
scanf("%s",n->subject);
printf("Enter the qualification of the teacher: ");
scanf("%s",n->qualification);
printf("Enter the degree of the teacher: ");
scanf("%s",n->degree);
printf("Enter the rank of the teacher: ");
scanf("%s",n->rank);
printf("Enter the office of the teacher: ");
scanf("%s",n->office);
n->next=0;
int c=0;
Teacher *p=t;
while(p!=0){
c++;
p=p->next;
}
insert(n,c);
}
}
else if(i==3){
if(t==0) printf("No teacher data file loaded yet.\n");
else{
Teacher *n=(Teacher *)malloc(sizeof(Teacher));
printf("Enter a new teacher ID: ");
scanf("%s",n->id);
printf("Enter the name of the teacher: ");
scanf("%s",n->name);
printf("Enter the gender of the teacher: ");
scanf("%c",n->gender);
printf("Enter the native place of the teacher: ");
scanf("%s",n->nativeplace);
printf("Enter the time when this teacher began to work: (yyyy/mm/dd) ");
scanf("%s",n->beginwork);
printf("Enter the subject of the teacher: ");
scanf("%s",n->subject);
printf("Enter the qualification of the teacher: ");
scanf("%s",n->qualification);
printf("Enter the degree of the teacher: ");
scanf("%s",n->degree);
printf("Enter the rank of the teacher: ");
scanf("%s",n->rank);
printf("Enter the office of the teacher: ");
scanf("%s",n->office);
n->next=0;
int c;
printf("Enter the index: ");
scanf("%d",&c);
insert(n,c);
}
}
else if(i==4){
char id[10];
printf("Enter the id: ");
scanf("%s",id);
del(id);
}
else if(i==5){
int i;
printf("Choose the way you want to search: ");
printf("1.Name 2.ID 3.Subject\n");
scanf("%d",&i);
search(i);
}
else if(i==6){
display();
}
else if(i==7){
char id[10];
printf("Enter the ID of the record you want to change: ");
scanf("%s",id);
modify(id);
}
else if(i==8){
save();
}
else if(i==9){
Teacher *p;
while(t!=0){
p=t->next;
free(t);
t=p;
}
break;
}
}while(1);
return 0;
}

㈧ 求C语言大神帮忙编写《教师信息管理系统》 不要用C++ 也没有指针的

不用指针还有点难办啊,总不能全都放在结构体数组里吧。

热点内容
ios6G与安卓12G哪个更快 发布:2025-01-24 11:26:22 浏览:827
下线源码 发布:2025-01-24 11:26:22 浏览:523
windows8解压软件 发布:2025-01-24 11:04:41 浏览:559
蓝牙聊天源码 发布:2025-01-24 11:03:13 浏览:124
安卓是什么意思是vivo吗 发布:2025-01-24 11:01:32 浏览:486
悬赏网源码 发布:2025-01-24 10:53:14 浏览:733
c语言时间变量 发布:2025-01-24 10:40:24 浏览:869
ppiandroid 发布:2025-01-24 10:25:50 浏览:1001
儿童压缩机 发布:2025-01-24 10:25:09 浏览:75
苹果的允许访问在哪里 发布:2025-01-24 10:24:32 浏览:32