示例#1
0
//---------------------------------------------------------------------
void academic()
{
FILE *fp,*fp1;
int d=7,i,m;
int k=0,l=0;                    //k==0-> node //l==0->node1
char ch,ch1;
struct time_t  t;
struct attend at;
textcolor(BLACK);
//textbackground(GREEN);
clrscr();
//header();
fp=fopen("TimeTable.txt","r+");
fp1=fopen("Attend.txt","r+");
//delay(1000);
printf("\n\n\n\t\t1.TIME TABLE");
//delay(500);
printf("\n\n\n\t\t2.ATTENDENCE");
//delay(500);
printf("\n\n\n\t\t3.HOME");
//delay(500);
printf("\n\n\nEnter your choice to proceed(1-3):");
fflush(stdin);
scanf("%c",&ch);
//Palce here a line with help and further instructions!
switch(ch)
{
case '1':
	clrscr();
       //header();
	printf("\n\n\t\t1.ADD");                //change
	printf("\n\t\t2.VIEW");
	printf("\n\t\t3.BACK");                   //   change
	printf("\nEnter ur choice(1-3):");
	fflush(stdin);
	scanf("%c",&ch1);
	switch(ch1)
	{

case '1':clrscr();
		       //	 header();
			 fseek(fp,0,SEEK_END);  		//TO APPEND THE FILE
			 i=1;
			 printf("\n\tEnter the Batch:");
			 fflush(stdin);
			 gets(t.batch);
			while(d>1)                                 //for 6 days
			{
			printf("\n\t\tEnter day%d:\t",i);
			fflush(stdin);
			gets(t.day);
			printf("\nEnter subjects:");
			printf("\n\nSubject1:");
			fflush(stdin);
			gets(t.mths);
			printf("\nSubject2:");
			fflush(stdin);
			gets(t.phys);
			printf("\nSubject3:");
			fflush(stdin);
			gets(t.bedc);
			printf("\nSubject4:");
			fflush(stdin);
			gets(t.ds);
			printf("\nSubject5:");
			fflush(stdin);
			gets(t.gncp);
			printf("\nSubject6:");
			fflush(stdin);
			gets(t.dslab);
			printf("\nSubject7:");
			fflush(stdin);
			gets(t.physlab);
			printf("\nSubject8:");
			fflush(stdin);
			gets(t.bedclab);
			fprintf(fp,"%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",t.day,t.mths,t.phys,t.bedc,t.ds,t.gncp,t.dslab,t.physlab,t.bedclab);
			d--;
			i++;
			}
			d=6;
			break;

		case '2':

			clrscr();
	     //		header();
			fseek(fp,0,SEEK_SET);
			  //rewind(fp);
		//	delay(1000);
			printf("\n\n\t\tThe time table is as follows....");
			delay(5000);
			printf("\n\n\t\t9-10\t10-11\t11-12\t12-13\t13-14\t14-15\t15-16\t16-17\n");
			for(m=0;m<8;m++)
		       {
			while(fscanf(fp,"%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",t.day,t.mths,t.phys,t.bedc,t.ds,t.gncp,t.dslab,t.physlab,t.bedclab)!=EOF)
			{
			//	 printf("%s",t.batch);
			 temp1=(node1*)malloc(sizeof(node1));
			 temp1->tab=t;
			 temp1->next=NULL;
			 if(l==0)
			 {
			 start1=temp1;
			 trav1=temp1;
			 }
			 else
			 {
			  trav1->next=temp1;
			  trav1=trav1->next;
			 }
			l++;
			}

			}
			displayt();
			break;

		case '3':
			 clrscr();
			 academic();
			 break;
		default:printf("Wrong choice!!");
			break;
			}
	break;
case '2':
       clrscr();
       //	header();
	printf("\n\n\t\t1.ADD");                        // change
	printf("\n\t\t2.VIEW");                          //   change
	printf("\n\t\t3.BACK");
	printf("\nEnter ur choice(1-3):");
	fflush(stdin);
	scanf("%c",&ch1);
	switch(ch1)
	{
case '1':
	clrscr();
   //	header();
	fseek(fp1,0,SEEK_END);                    //TO APPEND THE FILE
	i=1;
	d=8;
	while(d>=1)                                 //for 6 days
	{
	printf("\n\t\tEnter subject%d:",i);
	fflush(stdin);
	gets(at.sub);
	if(strlen(at.sub)>7)
	{
	printf("\nEnter the Practical Lab Attendance:");
	fflush(stdin);
	scanf("%f",&at.pp);
	}
	else
	{

	printf("\nEnter the percentage attendance for Lecture:");
	fflush(stdin);
	scanf("%f",&at.pl);
	printf("\nEnter the percentage attendance for Tutorial:");
	fflush(stdin);
	scanf("%f",&at.pt);
	at.ptt=((at.pl*(75/100))+(at.pt*(25/100)));
	}
	fprintf(fp1,"%s\t\t%0.2f\t\t%0.2f\t\t%0.2f\t\t%0.2f\n",at.sub,at.ptt,at.pl,at.pl,at.pp);
	d--;
	i++;
	}

	break;
case '2':

	 clrscr();

      //	header();
	fseek(fp1,0,SEEK_SET);
	//rewind(fp1);
	delay(1000);
	printf("\n\n\t\tThe attendence is as follows.....");
	delay(3000);
	printf("\n\nSUBJECT    LECTURE+TUTORIAL\tLECTURE \tTUTORIAL \tPRACTICAL\n\n");
	while(fscanf(fp1,"%s%f%f%f%f",at.sub,&at.ptt,&at.pl,&at.pt,&at.pp)!=EOF)
	{

	 temp=(node*)malloc(sizeof(node));
	 temp->sub1=at;
	 temp->next=NULL;

	  if(k==0)
	  {
	  start=temp;
	  trav=temp;
	  }
	  else
	  {
	  trav->next=temp;
	  trav=trav->next;
	  }
	  k++;
	}
	displaya();

	break;
case '3':clrscr();
	 academic();
	 break;

default:printf("Wrong choice!!");
	break;
	}

	break;

case '3':clrscr();
	 main1();
	 break;
default:printf("\nWrong choice entered");
	break;

}                             //complete switch
fclose(fp);
fclose(fp1);

getch();
}
示例#2
0
文件: credits2.c 项目: fourks/bb.js
void credits2(void)
{
    int i, ch;
    int p;
    int plast = -1;
    clrscr();

    centerprint(aa_imgwidth(context) / 2, aa_imgheight(context) / 3, 3, 128, "The", 0);
    centerprint(aa_imgwidth(context) / 2, 2 * aa_imgheight(context) / 3, 3, 128, "END", 0);
    drawptr = decrand;
    params->randomval = 50;
    timestuff(0, NULL, draw, 5000000);
    drawptr = NULL;
    params->randomval = 0;
    drawptr = pryc;
    timestuff(0, NULL, draw, MAXTIME);
    drawptr = NULL;
    clrscr();
    draw();
    load_song("bb3.s3m");
    bbupdate();
    starttime = endtime = TIME;
    play();
    bbwait(1);
    for (i = 0; i < LOGOHEIGHT; i++) {
	aa_puts(context, aa_scrwidth(context) / 2 - 2, LOGOY + i, AA_BOLD, "8  8");
	if (i)
	    aa_puts(context, aa_scrwidth(context) / 2 - 2, LOGOY + i - 1, AA_NORMAL, "8  8");
	bbflushwait(100000);
    }
    aa_puts(context, aa_scrwidth(context) / 2 - 2, LOGOY + i - 1, AA_NORMAL, "8  8");

#define LWIDTH

    for (i = aa_scrwidth(context) / 2; i; i--) {
	display8();
	displaya(i);
	bbflushwait(10000);
    }
    for (; i < 100; i++) {
	textclrscr();
	displaya(10 * sin(i * M_PI / 100));
	display8();
	bbflushwait(10000);
    }
    aa_puts(context, aa_scrwidth(context) / 2 - 9, LOGOY + 3, AA_DIM, "<PROJECT><PROJECT>");
    bbflushwait(100000);
    aa_puts(context, aa_scrwidth(context) / 2 - 9, LOGOY + 3, AA_NORMAL, "<PROJECT><PROJECT>");
    bbflushwait(100000);
    aa_puts(context, aa_scrwidth(context) / 2 - 9, LOGOY + 3, AA_BOLD, "<PROJECT><PROJECT>");
    bbflushwait(100000);
    aa_puts(context, aa_scrwidth(context) / 2 - 9, LOGOY + 3, AA_NORMAL, "<PROJECT><PROJECT>");
    bbflushwait(100000);
    bbwait(1000000);
    for (i = LOGOY; i > 1; i--) {
	textclrscr();
	displogo(i);
	bbflushwait(30000);
    }

    source = malloc(aa_imgwidth(context) * (aa_imgheight(context)));
    target = malloc(aa_imgwidth(context) * (aa_imgheight(context)));
    params->dither = AA_NONE;
    format(dual ? aa_scrwidth(context) / 2 : aa_scrwidth(context));
    p = 0;
    while (1) {
	if (p != plast) {
	    getsource();
	    displaytext(p);
	    gettarget();
	    morph();
	    displaytext(p);
	    aa_flush(context);
        emscripten_sleep(1);
	    plast = p;
	}
      again:
    emscripten_sleep(100);
#ifndef __DJGPP__
	//ch = aa_getkey(context, 100);
    ch = AA_NONE;
#else
	while ((ch = bbupdate()) == AA_NONE) ;
#endif

	switch (ch) {
	case '1':
	    load_song("bb.s3m");
	    bbupdate();
	    play();
	    break;
	case '2':
	    load_song("bb2.s3m");
	    bbupdate();
	    play();
	    break;
	case '3':
	    load_song("bb3.s3m");
	    bbupdate();
	    play();
	    break;

	case 'b':
	case 'k':
	case 'B':
	case 'K':
	case AA_BACKSPACE:
	case AA_UP:
	    p -= (aa_scrheight(context) - YSTART) / 2 * (dual + 1);
	    if (p < 0)
		p = 0;
	    break;
	case AA_DOWN:
	case AA_LEFT:
	case 'f':
	case 'F':
	case ' ':
	case 'j':
	case 'J':
	    p += (aa_scrheight(context) - YSTART) / 2 * (dual + 1);
	    if (p > textsize)
		p = textsize;
	    break;
	case 'q':
	case 'Q':
	case AA_ESC:
	    finish_stuff = 0;
	    backconvert(0, 0, aa_scrwidth(context), aa_scrheight(context));
	    bbupdate();
	    starttime = endtime = TIME;
	    drawptr = decbright;
	    timestuff(0, NULL, draw, 1000000);
	    textclrscr();
	    drawptr = NULL;
	    aa_flush(context);
        emscripten_sleep(1);
	    free(source);
	    free(target);
	    return;
	default:
	    goto again;
	}
	bbupdate();
	starttime = endtime = TIME;
    }
}