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();
if(n=='Y'||n=='y'){
}
else{
goto one;
}
}
}
int printMenu(){
int c;
clrscr();
printf("\nStudent Management system");
displayDate();
displayTime();
printf("\n1 List of all students");
printf("\n2 Insert new student");
printf("\n3 Search student");
printf("\n4 Update student");
printf("\n5 Delete student");
printf("\n6 Count student");
printf("\n7 Timpass PlayGame");
printf("\n8Exit");
printf("\nEnter Your Choice (1-8)");scanf("%d",&c);
return c;
}
int main(){
int c;
struct student x;
char *scno;
while(1){
c=printMenu();
switch(c){
case 1:
listStudent();
printf("\nPress any key to continue...");
getch();
break;
case 2:
x=readStudent();
insertStudent(x);
printf("\nPress any key to continue...");
getch();
break;
case 3:
printf("\nEnter Scno to search");scanf("%s",scno);
x=searchStudent(scno);
if(strcmpi(x.scno,scno)==0)
printStudent(x);
else
printf("\n%s - not Found");
printf("\nPress any key to continue...");
getch();
break;
case 4:
printf("\nEnter Scno to search");scanf("%s",scno);
updateFileStudent(scno);
printf("\nPress any key to continue...");
getch();
break;
case 5:
printf("\nEnter Scno to delete data");scanf("%s",scno);
deleteFileStudent(scno);
printf("\nPress any key to continue...");
getch();
break;
case 6:
printf("\nCurrent Strenth=%03d",countStudent());
printf("\nPress any key to continue...");
getch();
break;
case 7:
TimePassGame();
printf("\nPress any key to continur...");
getch();
break;
case 8:
exit(0);
}
}
}
Comments
Post a Comment