Displaying Source Code(s)
|
|
--------------------------------------------------------------------------------
Class Record Retrieval Program
--------------------------------------------------------------------------------
Description : This Program is Useful to record and maintain
student details like names, marks obtained etc.
#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<dos.h>
#include<stdlib.h>
#include<dir.h>
#define MAX_STUD 200
char logusr[80];
struct usrlog
{
char name[80];
struct date d;
struct time t;
};
struct user
{
char lname[80];
char lpassword[80];
int lmode;
};
struct student
{
char name[80];
char pinno[15];
int id;
};
struct midsubj
{
int midno;
char subject[25];
int tot;
long stoffset;
long endoffset;
};
struct marks
{
int id;
int marks;
};
struct date d;
void main()
{
(void)getdate(&d);
show();
mfunct();
}
mfunct()
{
int choice;
clrscr();
mloop:
gotoxy(1,25);
textcolor(MAGENTA);
cprintf(" GODAVARI INST. OF ENGG. & TECH.");
gotoxy(65,2);
textcolor(MAGENTA);
cprintf("Date: %d:%d:%d",d.da_day,d.da_mon,d.da_year);
gotoxy(30,5);
textcolor(YELLOW);
cprintf("MAIN ACCESS MENU");
textcolor(CYAN);
gotoxy(20,10);
cprintf("1. Register ");
gotoxy(20,11);
cprintf("2. Login " );
gotoxy(20,12);
cprintf("3. Help ");
gotoxy(20,13);
cprintf("0. Exit ");
gotoxy(40,17);
textcolor(GREEN);
cprintf(" Enter your choice:");
textcolor(RED);
choice=getche();
switch(choice)
{
case '1': Register();
break;
case '2': Login();
break;
case '3':
clrscr();
gotoxy(1,25);
textcolor(MAGENTA);
cprintf(" GODAVARI INST. OF ENGG. & TECH.");
textcolor(YELLOW);
gotoxy(10,10);
cprintf(" * Select "1" for Registering your self to the
program.");
gotoxy(10,12);
cprintf(" * Select "2" for Loging in if you are Registered.");
gotoxy(10,14);
cprintf(" * select "0" to exit the program. ");
getch();
clrscr();
goto mloop;
case '0': Endprogram();
break;
default:
clrscr();
gotoxy(30,12);
textcolor(RED);
cprintf(" WRONG CHOICE SELECT AGAIN");
getch();
clrscr();
goto mloop;
}
}
Endprogram()
{
clrscr();
textmode(1);
gotoxy(7,10);
textcolor(GREEN);
cprintf(" THANKS FOR USING THE PROGRAM");
gotoxy(7,13);
textcolor(MAGENTA);
cprintf("GODAVARI INST. OF ENGG. & TECH.");
gotoxy(12,21);
textcolor(CYAN);
cprintf(" Program Coded By ");
gotoxy(10,23);
cprintf(" ANIL KUMAR YANAMANDRA");
gotoxy(6,25);
cprintf("Email: yanamandraanil@yahoo.com");
getch();
textmode(2);
exit(0);
}
show()
{
textmode(1);
textbackground(1);
clrscr();
gotoxy(4,2);
textcolor(5);
cprintf("GODAVARI INST. OF ENGG. & TECH.");
textcolor(1251);
gotoxy(5,8);
cprintf(" CLASS RECORD RETRIVAL PROGRAM");
gotoxy(16,10);
textcolor(BROWN);
cprintf("VER 1.0.0");
gotoxy(13,16);
textcolor(2);
cprintf("C- Project by");
gotoxy(9,18);
cprintf("ANIL KUMAR YANAMANDRA");
gotoxy(12,19);
cprintf("Pin#:04551A0505");
sleep(3);
gotoxy(12,25);
printf(" Press any key to continue");
getch();
textmode(2);
textbackground(BLACK);
clrscr();
textcolor(WHITE);
}
/* This function returns 0 if id is not present and returns
loginmode
if
id is present 1. student mode 2. faculty mode, 3. Admin mode-1
if no
users are present*/
int checkuser(char *lname)
{
static FILE *p;
static struct user usr;
int found=1;
p=fopen("reguser.dat","r");
if(p==NULL)
{
return(-1);
}
while(fread(&usr,sizeof(usr),1,p)==1)
{
found=1;
if(strcmp(lname,usr.lname)==0)
{
found=0;
break;
}
}
fclose(p);
if(found==0)
return(usr.lmode);
else
return(0);
}
Register()
{
static FILE *p;
static struct user usr;
int check,i;
char c2,c,password[80];
regloop:
clrscr();
gotoxy(1,25);
textcolor(MAGENTA);
cprintf("GODAVARI INST. OF ENGG. & TECH.");
gotoxy(65,2);
textcolor(MAGENTA);
cprintf("Date: %d:%d:%d",d.da_day,d.da_mon,d.da_year);
gotoxy(30,5);
textcolor(YELLOW);
cprintf("REGISTRATION FORM");
gotoxy(10,10);
textcolor(CYAN);
cprintf("Enter Login name :");
gotoxy(10,11);
cprintf("Enter Login Password:");
gotoxy(10,12);
cprintf("Enter Login Mode :");
gotoxy(1,19);
textcolor(RED);
cprintf("** Login Modes 1.Student 2. Faculty 3. Administrator");
strcpy(usr.lname,"
|
|
|