1.c Ȩ?限管???ϵͳԴ??
2.CVS权限管理
c Ȩ????ϵͳԴ??
#include "stdio.h"
#include "stdlib.h"
#include "conio.h"
#include "math.h"
#include "ctype.h"
#include "string.h"
#define MAX 4
#define TERM 6
struct STUD{
unsigned number;
char name[];
unsigned score[MAX];
float average;
struct STUD *next;
};
struct CLASS{
unsigned no;
unsigned students;
float score[MAX];
float average;
struct STUD *first;
};
//输出所有学生的成绩及名次
void output(struct CLASS *pclass)
{
struct STUD *p;
int n=0;
printf("Class:%u\t number of students:%u\n",pclass->no ,pclass->students );
printf("number name math physics politics "
"english average place\n");
for(n=1,p=pclass->first ;p!=NULL;p=p->next ,++n)
printf("%-8u%-s%-8u%-8u%-8u%-8u%-.2f%-d\n",
p->number ,p->name ,p->score[0] ,p->score [1],
p->score [2],p->score [3],p->average ,n);
}
//按平均成绩排序
void sort(struct CLASS *pclass)
{
struct STUD *p, *next, *last;
int m,n;
for(m=0;m<pclass->students -1;m++)
for(last=p=pclass->first ,n=0;n<pclass->students-1-m;
n++,last=p,p=p->next)
if(p->average<p->next->average){
next=p->next;
if(p!=pclass->first)
last->next=next;
else
pclass->first=next;
next->next=p;
p=next;
}
}
char *cou[MAX]={ "math","phusics","politics","english"};
//将链表所有接点写入文件
void write_file(struct CLASS *pclass,FILE *myfile)
{
struct STUD *p;
for(p=pclass->first;p!=NULL;p=p->next)
fwrite(p,sizeof(struct STUD),1,myfile);
}
//从文件中读数据重建链表
void read_file(struct CLASS *pclass,FILE *myfile)
{
struct STUD buf,*p,*tail;
int n;
for(tail=pclass->first ,n=0;n<pclass->students ;tail=p,++n){
if(fread(&buf,sizeof(struct STUD),1,myfile)!=1){
pclass->students =n;
break;
}
p=(struct STUD *) malloc(sizeof(struct STUD));
*p=buf;
//连接成先进先出链表
if(pclass->first==NULL)
pclass->first =p;
else
tail->next =p;
p->next =NULL;
}
}
//增加信息
void insert(struct CLASS *pclass)
{
struct STUD *p,*current,*last;
int k,ch,flag;
do{
p=(struct STUD *) malloc(sizeof(struct STUD));
printf("\ninput number and name of student:");
scanf("%u%s",&p->number ,p->name );
while(1){
for(flag=1,k=0;k<MAX;++k){
printf("\niput %s:",cou[k]);
scanf("%u",&p->score[k]);
if(p->score[k]>)
flag=0;
}
if(flag) break;
printf("score error\n");
}
p->average =(float)(p->score[0]+p->score[1]+p->score[2]+p->score[3])/4;
//找插入点
for(last=current=pclass->first;current->next&¤t->average>p->average;
last=current,current=current->next );
if(current->next ==NULL&¤t->average>p->average){
p->next =NULL;
current->next =p;
}
else{
p->next =current;
if(current==pclass->first)
pclass->first =p;
else
last->next =p;
}
pclass->students ++;
printf("continue?(y/n)");
while(isspace(ch=getchar()));
}while (ch=='y'||ch=='Y');
}
//删除学生
void delete_stu(struct CLASS *pclass)
{
unsigned ch;
struct STUD *current,*last,*p;
do{
printf("\ninput number of student:");
scanf("%u",&p->number,&ch);
for(last=current=pclass->first;current!=NULL&¤t->number!=ch;
last=current,current=current->next);
if(current!=NULL){
if(current!=pclass->first)
last->next=current->next;
else
pclass->first=current->next;
free(current);
pclass->students--;
}
else
fprintf(stderr,"error:number of student!\n");
printf("continue?(y/n)");
while(isspace(ch=getchar()));
}while (ch=='y'||ch=='Y');
}
void create(struct CLASS *pclass)
{
struct STUD *p,*tmp=NULL;
int n=0,k,ch,flag;
do{
p=(struct STUD *) malloc(sizeof(struct STUD));
printf("\ninput number and name of student:");
scanf("%u%s",&p->number ,p->name );
while(1){
for(flag=1,k=0;k<MAX;++k){
printf("\niput %s:",cou[k]);
scanf("%u",&p->score[k]);
if(p->score[k]>)
flag=0;
}
if(flag) break;
printf("score error\n");
}
p->average =(float)(p->score[0]+p->score[1]+p->score[2]+p->score[3])/4;
p->next =pclass->first ;
pclass->first =p;
++n;
printf("continue?(y/n)");
while(isspace(ch=getchar()));
}while (ch=='y'||ch=='Y');
pclass->students =n;
}
//计算平均分
void average(struct CLASS *pclass)
{
static double general[MAX],g;
struct STUD *p;
int i;
for(p=pclass->first;p!=NULL;p=p->next)
for(i=0;i<MAX;++i)
general[i]+=p->score[i];
printf("\n math physics politics english\n");
for(i=0;i<MAX;++i){
pclass->score[i]=general[i]/pclass->students ;
printf("%.2f",pclass->score[i]);
g+=general[i];
}
pclass->average =g/(MAX*pclass->students );
printf("\ngeneral average:%.2f\n",pclass->average );
}
void main()
{
struct CLASS cla;
FILE *fp;
int flag=1,k;
char c,*menu[]={
"\n1:insert a student\n",
"2:delete a student\n",
"3:save into file\n",
"4:print class score list\n",
"5:stat average\n",
"0:exit\n",
"\nselect[0-6]:"
};
if((fp=fopen("students.dat","rb"))==NULL){
printf("input number of class:");
scanf("%u",&cla.no);
cla.students=0;
cla.first=0;
create(&cla);
sort(&cla);
}
else{
fread(&cla,sizeof(struct CLASS),1,fp);
cla.first=NULL;
read_file(&cla,fp);
fclose(fp);
}
while(flag){
for(k=0;k<=TERM;k++)
printf("%s",menu[k]);
scanf("%d",&k);
switch (k){
case 1:
insert(&cla);
break;
case 2:
delete_stu(&cla);
break;
case 3:
if((fp=fopen("students.dat","wb"))==NULL){
fprintf(stderr,"error:can't create file students!\n");
return;
}
fwrite(&cla,sizeof(struct CLASS),1,fp);
write_file(&cla,fp);
fclose(fp);
break;
case 4:
output(&cla);
break;
case 5:
average(&cla);
break;
case 0:
printf("save yout change?(y/n)");
scanf("%c%*c",&c);
c=='y'||c=='Y'?(c=1):(c==0);
if(c){
if((fp=fopen("students.dat","wb"))==NULL){
fprintf(stderr,"error:can't create file students!\n");
return;
}
rewind(fp);
fwrite(&cla,sizeof(struct CLASS),1,fp);
write_file (&cla,fp);
fclose(fp);
}
flag=0;
break;
default:
fprintf(stderr,"select error!\n");
}
}
}
CVS权限管理
CVS的权限管理主要有两种策略。第一种是理系基于系统文件权限的系统用户管理,适用于多个在Linux上使用系统帐号的统源开发人员进行开发。通过将/home/cvsroot目录的限管所有权设置为apache.apache,然后赋予该目录的理系mot c 源码权限,可以实现Linux上通过ssh连接CVS服务器的统源更新ip源码多个开发人员的文件共享读写。只要开发人员属于apache组,限管他们就能读写任何他们导入的理系项目文件,因为导入的统源项目文件默认拥有权限,这表示文件对组的限管权限为读写。 第二种策略是理系基于CVSROOT/passwd的虚拟用户管理,适用于多个在Windows平台上的统源开发人员将帐号映射成系统帐号使用。在passwd文件中,限管协会网站 源码通过映射虚拟用户到apache用户,理系可以实现文件的统源共享读写。通过CVSROOT/passwd和readers writers等文件管理用户的访问权限,并通过cvstrac设置所有虚拟用户都映射到apache用户上。eos源码赏析 使用这两种策略,结合apache/apache用户,可以方便地在Linux和Windows平台上实现CVS版本控制系统的权限管理。这使得开发人员能够高效地进行代码的flipthegun 源码下载共享、管理和版本控制,无论他们使用的是哪种操作系统。 通过CVS WinCVS、CVSWeb和CVSTrac这三种工具的结合使用,可以构建一个相对完善的跨平台工作组开发版本控制环境。这不仅简化了权限管理,还提高了开发效率和协作能力,使得开发团队能够在不同的操作系统环境中协同工作,确保代码版本的统一和安全。扩展资料
CVS是一个C/S系统,多个开发人员通过一个中心版本控制系统来记录文件版本,从而达到保证文件同步的目的。CVS版本控制系统是一种GNU软件包,主要用于在多人开发环境下的源码的维护。2024-11-29 22:361355人浏览
2024-11-29 22:082547人浏览
2024-11-29 22:08949人浏览
2024-11-29 21:43162人浏览
2024-11-29 21:272327人浏览
2024-11-29 20:142941人浏览
1.手机淘宝网客户端软件介绍手机淘宝网客户端软件介绍 淘宝公司为Android手机用户精心打造了一款专属应用——手机淘宝网客户端。这款软件专为Android手机设计,旨在提供流畅的购物体验,让手机