0% found this document useful (0 votes)
15 views4 pages

Aji Set B

The document contains code for a C program that implements a basic student record management system with a main menu allowing the user to create a new file, add records, browse existing records, and close. It includes functions to display different screens and handles input/output operations to store and retrieve student data from a text file.

Uploaded by

Iruguin Angel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views4 pages

Aji Set B

The document contains code for a C program that implements a basic student record management system with a main menu allowing the user to create a new file, add records, browse existing records, and close. It includes functions to display different screens and handles input/output operations to store and retrieve student data from a text file.

Uploaded by

Iruguin Angel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

#include<utility.

h>
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<conio.h>
#include<dos.h>
#include<windows.h>

void screen1()
{

// line1(4,2,90,24);
line2(6,3,88,23);
line1(8,4,86,8);
center(5,"Polytechnic University of the Phils.");
center(6,"San Juan Campus");
center(7,"San Juan City");
line1(8,9,45,22);
line1(48,9,86,22);
printxy(60,14,"Programmed");
printxy(60,16,"By: AJI");
line1(15,10,38,12); //MAIN MENU
printxy(23,11,"Main Menu");
printxy(12,13,"A] Create a new file");
printxy(12,15,"B] Add a record");
printxy(12,17,"C] Browse");
printxy(12,19,"D] Close");
printxy(20,21,"Select an option");

line1(6,25,88,27); //reserve for error


gotoxy(37,21);gets;
}

void screen4()
{
clearportion(49,10,85,21);
// line1(4,2,90,24);
line2(6,3,88,23);
line1(8,4,86,8);
center(5,"Polytechnic University of the Phils.");
center(6,"San Juan Campus");
center(7,"San Juan City");
line1(8,9,45,22);
line1(48,9,86,22);

//shrak

fillscreen(52,19,56,19,178); //water
fillscreen(51,20,55,20,178);
fillscreen(54,21,79,21,178);
fillscreen(78,19,82,19,178);
fillscreen(79,20,83,20,178);

fillscreen(65,11,69,19,219); //body
fillscreen(63,12,71,19,219);
fillscreen(61,13,73,19,219);
fillscreen(59,14,75,19,219);
fillscreen(57,15,77,19,219);
fillscreen(56,19,78,20,219);
fillscreen(59,12,61,12,178); //eyes
fillscreen(57,13,59,13,178);
fillscreen(73,12,75,12,178);
fillscreen(75,13,77,13,178);

fillscreen(55,17,55,17,178); //gills
fillscreen(79,17,79,17,178);

fillscreen(65,16,69,16,31); //mouth
fillscreen(65,17,69,17,30);
// printxy(65,19,"i bite");

line1(15,10,38,12); //MAIN MENU


printxy(23,11,"Main Menu");
printxy(12,13,"A] Create a new file");
printxy(12,15,"B] Add a record");
printxy(12,17,"C] Browse");
printxy(12,19,"D] Close");
printxy(20,21,"Select an option");
line1(6,25,88,27);
center(26,"THANK YOU GOODBYE !!");
getch();
system("cls");
}

main()
{
char sn[20];
char ln[20];
char fn[20];
char mi[10];
int pc;

char ans=' ';


int x;

while(ans!='D')
{
screen1();
ans=toupper(getch());

if (ans =='A')
{
fclose(fopen("new.txt", "w"));
printxy(30,26,"Your file has now been reset");
screen1();
}

else if(ans == 'B')


{
clearportion(49,10,85,21);

FILE *fnew;
fnew=fopen("new.txt","a");
for(x=0;x<=2;x++)
{
printxy(50,10,"Student Number:");
printxy(50,12,"Last Name:");
printxy(50,14,"First Name:");
printxy(50,16,"M.I:");
printxy(50,18,"Program Code: ");

gotoxy(65,10);scanf("\n");gets(sn);
gotoxy(60,12);scanf("\n");gets(ln);
gotoxy(61,14);gets(fn);
gotoxy(54,16);gets(mi);
gotoxy(63,18);scanf("\n");scanf("%d",&pc);

fprintf(fnew,"\n%s %s %s %s %d",sn,ln,fn,mi,pc);
clearportion(49,10,85,21);
}

fclose(fnew);
system("cls");
printxy(32,26,"Your file has now been updated");

screen1();

else if (ans =='C')


{
system("cls");

center(2,"Polytechnic University of the Phils.");


center(3,"San Juan Campus");
center(4,"San Juan City");
printxy(2,6,"Page: ");
printxy(28,8,"#\tStudent #\t\tStudent name\t\tProgram");

printxy(28,9,"=================================================================");

FILE *fnew;
fnew=fopen("new.txt","r");
while(fscanf(fnew,"\n%s %s %s %s %d",sn,ln,fn,mi,&pc)!=EOF)
{
printf("\n\t\t\t\t%s",sn);
printf("\t\t%s %s %s",ln,fn,mi);
printf("\t\t%d",pc);
}
fclose(fnew);
getch();
system("cls");
screen1();
}

else if(ans<<'D')
{
printxy(30,26,"ERROR");
screen1();
}
else
{
break;
}
}
clearportion(7,26,85,26);
screen4();
}

You might also like