當前位置:首頁 » 編程語言 » c語言考勤系統刪除功能描述
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

c語言考勤系統刪除功能描述

發布時間: 2023-02-09 01:25:47

1. c語言程序設計學生考勤系統

是位運算,先把a,b轉化成二進制,然後位相或,有1出1,無1出0 比如 a=5 b=2 5的二進製表示是101 2的二進製表示是10 那麼101|10=111 111十進製表示是7 所以a|b=7 如果a=3 b=2 那麼a|b 結果是 11|10=11 a|b=3

2. c語言學生成績管理系統程序設計,有添加,查找,刪除,輸出,修改,排序等功能!!!

同學你參照下,有不懂的,網路上Hi我
#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
#include<string.h>
struct sc
{
int chinese;
int maths;
int english;
};

typedef struct node
{
int num;
char name[20];
struct sc score;
struct node *next;
}st;

int menu()//菜單
{
int choice;
do{
system("cls");
printf("\t1.input the messega about a student\n");

printf("\t2.insect a messega of a new student\n");

printf("\t3.look for the messega\n");

printf("\t4.dellect the messega\n");

printf("\t5.arranging base on the number of learning\n");

printf("\t6.output all the messega\n");

printf("\t7.arranging base on all scores\n");

printf("\t8.exit the system\n");

printf("\tplease input your choice:");

scanf("%d",&choice);
}while(choice>7&&choice<1);
return choice;
}

st *create()//創建鏈表
{
st *head,*p,*tail;
char c;
head=tail=NULL;
while(c!='n'&&c!='N')
{

p=(st *)malloc(sizeof(st));
p->next=NULL;
printf("\t\tplease input the number of learning:");
scanf("%d",&p->num);

printf("\t\tplease input the name:");
scanf("%s",p->name);

printf("\t\tplease input the score of chinese:");
scanf("%d",&p->score.chinese);

printf("\t\tplease input the score of maths:");
scanf("%d",&p->score.maths);

printf("\t\tplease input the score of english:");
scanf("%d",&p->score.english);
if(head==NULL)

head=tail=p;
else
{
tail->next=p;
tail=p;
}

printf("\t\tcontinue or stop(Y/N):");
scanf("%s",&c);
}
return head;
}

st *arrange(st *head)// 以學號排名
{
st *p,*q;
int t,i=1,j,chinese,maths,english;
char name[20];
p=head;
if(head==NULL)
printf("\t\tNoting to arrange\n");
else
{
do
{
j=1;
while(p->next!=NULL)
{
q=p->next;
if(p->num>=q->num)
{
t=p->num;
p->num=q->num;
q->num=t;

strcpy(name,p->name);
strcpy(p->name,q->name);
strcpy(q->name,name);

chinese=p->score.chinese;
p->score.chinese=q->score.chinese;
q->score.chinese=chinese;

maths=p->score.maths;
p->score.maths=q->score.maths;
q->score.maths=maths;

english=p->score.english;
p->score.english=q->score.english;
q->score.english=english;

}
p=q;
j++;
}
p=head;
i++;
}while(i!=j);
}
return head;
}

st *arrangeall(st *head)//以總分排名
{
st *p,*q;
int t,i=1,j,chinese,maths,english;
char name[20];
p=head;
if(head==NULL)
printf("\t\tNoting to arrange\n");
else
{
do
{
j=1;
while(p->next!=NULL)
{
q=p->next;
if(p->score.chinese+p->score.maths+p->score.english<q->score.chinese+q->score.maths+q->score.english)
{
t=p->num;
p->num=q->num;
q->num=t;

strcpy(name,p->name);
strcpy(p->name,q->name);
strcpy(q->name,name);

chinese=p->score.chinese;
p->score.chinese=q->score.chinese;
q->score.chinese=chinese;

maths=p->score.maths;
p->score.maths=q->score.maths;
q->score.maths=maths;

english=p->score.english;
p->score.english=q->score.english;
q->score.english=english;

}
p=q;
j++;
}
p=head;
i++;
}while(i!=j);
}
return head;
}

st *insect(st *head,st *t)//插入學生的信息
{
st *p,*q;
p=head;
if(head==NULL)
printf("\tThe list is empty\n");
else
{

if(t->num==p->num)
{
head=t;
t->next=p;
}
else
{
while(p->next!=NULL)
{
q=p->next;
if(p->num<=t->num&&q->num>=t->num)
{
t->next=q;
p->next=t;
}
p=q;
}
p->next=t;
}
}
return head;
}

void output(st *head)//輸出所以學生的信息
{
st *p;
int i=0;
float sum1=0,sum2=0,sum3=0;
p=head;
if(head==NULL)
{
printf("\tThere is nothing \n");
return;
}
else
{
printf("\tnumber name chinese maths english allscores\n");
while(p)
{
printf("\t %d ",p->num);
printf(" %s ",p->name);
printf(" %d ",p->score.chinese);
printf(" %d ",p->score.maths);
printf(" %d ",p->score.english);
printf("%6d",p->score.chinese+p->score.maths+p->score.english);
printf("\n");
p=p->next;
}

p=head;
while(p)// avrege scores
{
sum1+= p->score.chinese;
sum2+=p->score.maths;
sum3+=p->score.english;
p=p->next;
i++;
}
printf("\tarvege %.2f %.2f %.2f %.2f \n",sum1/i,sum2/i,sum3/i,(sum1+sum2+sum3)/i);

}
system("pause");
}

st *dellect(st *head,st *d)//刪除學生的信息
{
st *p,*q;
char c;
p=head;
if(!(strcmp(p->name,d->name)))
{
head=p->next;
free(p);
}
else
{
while((strcmp(p->name,d->name))&&p->next!=NULL)
{
q=p;
p=q->next;
}
if(!(strcmp(p->name,d->name)))
{
printf("do you want to delete %S ?(Y/N):",p->name);
scanf("%s",&c);

if(c=='y'||c=='Y')
{
q->next=p->next;
free(p);
}
}
else
printf("\tThere isn't this name\n");
}

return head;
}

void find(st *head,st *s)//查找學生的信息
{
st *p,*q;
p=head;
if(head==NULL)
printf("\tThe list is empty\n");
else
{

while((strcmp(p->name,s->name))!=0&&p->next!=NULL)
{

q=p;
p=q->next;
}

if((strcmp(p->name,s->name))==0)

{
printf("\t %d ",p->num);
printf(" %s ",p->name);
printf(" chinese=%d ",p->score.chinese);
printf(" maths=%d ",p->score.maths);
printf(" english=%d ",p->score.english);
printf("all=%d",p->score.chinese+p->score.maths+p->score.english);
printf("\n");
}
else
printf("\tThe name is missing\n");
}
system("pause");
}

void main()//主函數
{
st *head,*t,*s,*d;
int choice;

for(;;)
{
choice=menu();
switch(choice)
{

case 1:
head=create();
break;

case 2:
t=(st *)malloc(sizeof(st));
t->next=NULL;
printf("\t\tplease input the number of learning:");
scanf("%d",&t->num);

printf("\t\tplease input the name:");
scanf("%s",t->name);

printf("\t\tplease input the score of chinese:");
scanf("%d",&t->score.chinese);

printf("\t\tplease input the score of maths:");
scanf("%d",&t->score.maths);

printf("\t\tplease input the score of english:");
scanf("%d",&t->score.english);

head=insect(head,t);
break;

case 4:

d=(st *)malloc(sizeof(st));
d->next=NULL;
printf("\twhice student do you want to dellect?please input the name:");
scanf("%s",d->name);
head=dellect(head,d);
break;

case 3:

s=(st *)malloc(sizeof(st));
s->next=NULL;
printf("\twhice student do you want to look for?please input the name:");
scanf("%s",s->name);
find(head,s);
break;

case 5:
head=arrange(head);//number
break;

case 6:
output(head);
break;
case 7:
head=arrangeall(head);//score
break;

case 8:
printf("\t\tThank you,goodbye\n");
exit(0);
}
}

}

3. 我用C語言寫了一個學生管理系統,就是刪除功能不知如何編寫,想問問如何實現對結構體數組其中的一項清空

很簡單。
假設你定義的結構體數組大小為MaxSize=1000,你可以定義一個當前數組中的學生數Size,
該數值隨著錄入的學生信息的多少而變化。
現在假設數組中有500個學生的信息,也即Size=500;你需要刪除其中一個學生的資料。
通過查找你得到這個學生的信息存儲在第100號結構中,
那麼你將101號的學生的信息覆蓋到100號結構中(例如:student[99]=student[100]),再將102號的學生的信息復制到101號結構中,依次復制,直到將500號結構中的學生信息復制到499號結構中。然後改寫Size=499。
上面的復制過程可以通過一個for循環來實現,100號之前的結構都不用動。
這樣,當前學生結構數組中就少了原來100號結構中的學生信息,也就是刪除掉了。

4. 學生考勤管理系統C語言代碼

#include "stdio.h"
#include "string.h"
int main()
{
char name[50][8];
int grade[20][4];
int zm=0;
int ze=0;
int zc=0;
int zz=0;
int n;
int i;
printf("Please input the nummber of students:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Please input the %dth student's name:",i+1);
scanf("%s",&name[i]);
printf("Please input the %dth student's Math score:");
scanf("%d",&grade[i][0]);
printf("Please input the %dth student's English score:");
scanf("%d",&grade[i][1]);
printf("Please input the %dth student's Computer score:");
scanf("%d",&grade[i][2]);
grade[i][3]=grade[i][0]+grade[i][1]+grade[i][2];
}
printf("Name Math Enlish Computer total\n");
for(i=0;i<n;i++)
printf("%s\t%d\t%d\t%d\t %d\t\n",name[i],grade[i][0],grade[i][1],grade[i][2],grade[i][3]);
return 0;

}

5. 如何用c語言文件操作來實現刪除文件某段內容功能

C語言刪除磁碟文件內容中間一段字元串的方法
假定磁碟文件中連續存放了相同長度的若干段字元串,要刪除中間的某一段字元串,剩下的繼續保存在文件中。

代碼如下,有比較清楚的注釋。
//變數定義部分省略
file=fopen(pathname,"rb");//打開磁碟文件,file是文件指針,pathname是磁碟文件的路徑和文件名
filedata[0] = (char *)malloc(LENGTH*sizeof(char));//filedata是指針數組用於存放刪除後的臨時數據,LENGTH是每個字元串的相同長度
//找出要刪除的字元串,並將其它的字元串存入臨時指針數組
for(found=0,y=0;fread(filedata[y],LENGTH,1,file); )//found用於判斷是否找到要刪除的字元串
{
*(filedata[y]+LENGTH)='\0';
if(found==0)//沒有找到前才進行比較
{
if( strcmp(deldata,filedata[y])==0 )//deldata是要刪除的字元串
{
found=1;
//找到要刪除的字元串,從臨時存放的指針數組中刪除
free(filedata[y]);
y--;
}
}
y++;
filedata[y] = (char *)malloc((LENGTH+1)*sizeof(char));
}
free(filedata[y]);//y多加了1,多申請了一段內存空間
fclose(file);
if(found==0)

{
printf("沒有找到要刪除的字元串。\n");

}

else//將已刪除指定字元串後剩餘的所有數據從臨時存放的指針數組中重新保存到磁碟文件
{
file=fopen(pathname,"wb");
for(m=0;m
{
fwrite(filedata[m],LENGTH,1,file);
free(filedata[m]);//釋放內存
}
fclose(file);
}

6. C語言的班級考勤系統

/*學生考勤結構體*/

typedef struct{
int no; //學號
char cl[8]; //班級
char name[8]; //姓名
char sex[3]; //性別
char date[13]; //日期
int flag; //出勤情況
int num; //出勤次數
int scr; //出勤分數
}stu;

/*函數聲明*/
int menu();//主目錄
void cnum();
Print();

/*定義全局變數*/
stu cla[51]; //只設定1個班,按需要自己設定數組大小

/*主函數*/

main()
{
int flag=1;
while(flag)
{
switch(menu)
case 1:
cnum();
case 2:
Print();
case 0:
flag=0;
}
printf("歡迎下次使用");
getch();
}

int menu() //製作歡迎菜單
{
int n;
printf(" 歡迎登陸考勤系統\n");
printf("1、點名(記錄學生出勤情況)\n");
printf("2、查看出勤結果(查看學生出勤得分)\n");
printf("0、退出\n");
printf("請選擇:");
scanf("%d",&n);
return n;
}

cnum()
{
int flag=1; //標記
int i=1;
int cl;
printf("請輸入上課班級編號:");
scanf("cl");
while(flag)
{
printf("\n開始點名!");
printf("\n請輸入來到的同學學號(以0號結束):");//為了方便計算學號跟數組下標一致,零號空去
scanf("%d",&flag);
if(flag!=0)
{
cla[i].no=flag;
cla[i].cl=cl;
·
·
·//輸入數據在此省略
printf("輸入該同學有沒有到(0代表沒有到,1代表到):");
scanf("%d",&flag);
·
·
·
}
}
}
Print()
{
//列印所有str裡面的信息
}

大概思路是這樣,自己看這要求修改吧!因為我都不清楚你的要求

7. C語言成績管理系統刪除信息

voidremove(MESSAGEmessage[]){
inti,j,n,num;
intflag=1;
n=ReadMESSAGEFromFILE(message);
printf("請輸入要刪除學生的學號:");
scanf("%d",&num);
for(i=0;i<n;i++){
if(num==message[i].number){
for(j=i;j<n-1;++j)
message[i]=message[i+1];
printf("該學生的信息已刪除成功! ");
flag=0;
--n;
break;
}
}
if(flag==1)printf("該學生的信息不存在。 ");
WriteAllMESSAGEtoFILE(message,n);
}

8. c語言信息管理系統中刪除功能中fseek(fp,a,0);是什麼意思 功能是什麼求高手幫忙

int fseek( FILE *stream, long offset, int origin );
第一個參數stream為文件指針
第二個參數offset為偏移量,正數表示正向偏移,負數表示負向偏移
第三個參數origin設定從文件的哪裡開始偏移
fseek(fp,a,0)就是把文件指針fp從文件頭偏移a個位元組的位置

9. c語言中刪除模塊,描述出演算法思想

你給的這些信息跟本無法下手啊。。。刪除模塊最常用的方法就是把原文件中的類容全部讀取出來,存在一個結構體或數組中,然後根據條件,刪除之後,再寫入文件,覆蓋原有文件...達到刪除的效果..

10. C語言程序設計;學生考勤管理系統

用鏈表做