Posts

Showing posts from April, 2022

projectstu.h of student management system header file

 #include<dos.h> void displayTime(){  struct time curtime;  gettime(&curtime);  printf("\t\t%02d:%02d:%02d",curtime.ti_hour,curtime.ti_min,curtime.ti_sec); } void displayDate(){   struct date today;   getdate(&today);   printf("\n%02d/%02d/%04d",today.da_day,today.da_mon,today.da_year); } int countStudent() { FILE *fp; int n,last; fp=fopen("student.dat","rb");//open file in binary mode     fseek(fp,0,SEEK_END);     last=ftell(fp);     n=last/sizeof(struct student); fclose(fp); return n; } void listStudent() { FILE *fp; int n,i; struct student x;     fp=fopen("student.dat","rb");//open file in binary mode n=countStudent();     for(i=0;i<=n-1;i++)     {      fread(&x,sizeof(x),1,fp);      printStudent(x);     }     fclose(fp); } struct student searchStudent(char *scno) { FILE *fp; int n,i; struct stude...

strucstu.h file of student management system

 #include<stdio.h> #include<conio.h> #include<string.h> struct mydate{    int d,m,y; }; struct student{     char name[80];     char scno[80];     int mark;     int age;     struct mydate dob; }; struct student readStudent(){     struct student x;     fflush(stdin);     printf("Enter Name:");gets(x.name);     printf("Enter scno:");gets(x.scno);     printf("Enter mark:");scanf("%d",&x.mark);     printf("Enter age:");scanf("%d",&x.age);     printf("Enter DoB:");scanf("%d%d%d",&x.dob.d,&x.dob.m,&x.dob.y);     return x; } struct student updateStudent(struct student x){     fflush(stdin);     int c;     //update name     printf("\nCurrent Name = %s",x.name);     printf("\nDo you want to change name(y/n)");c=getchar();     fflush(stdin);     if(...

STUDENTMANAGEMENT.CPP

 #include<studstru.h> #include"projstud.h" #include <process.h> #include<stdlib.h> void TimePassGame(){  one: srand (time (0));        int rannum = rand () % 100 + 1;        int myn;   textcolor(RED);   textbackground(WHITE);      cprintf("\nEnter the number Between  1-100 ");        cscanf("%d",&myn);        for(int attemp=1; myn!=rannum; attemp++){ if(myn>rannum){ cprintf("\nPlease enter lower number"); cscanf("%d",&myn); } else if(myn<rannum){ cprintf("\nPlease enter  Greater number "); cscanf("%d",&myn); } }        cprintf("\n You Won The Game In %d Attempts",attemp); cprintf("\nHave A Nice Day.."); cprintf("\n You want to Play Again\tY/N"); char ans = getch(); if(ans=='y'||ans=='Y'){ goto one; } else{ cprintf("\nAre You Sure Wanna Exit\t Y/N"); char n= getch()...