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

Ginisang Luwi Komplete

The document contains code for a C program that implements a menu-driven student record system. It includes functions for displaying main and option menus, handling user input and file operations to create, add to, and view a student records text file. The main menu function displays boxes and labels for navigation and information. Option functions ask yes/no questions for confirming file resets or additions. Record data is read from and written to a file with functions for the menu options.

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 views7 pages

Ginisang Luwi Komplete

The document contains code for a C program that implements a menu-driven student record system. It includes functions for displaying main and option menus, handling user input and file operations to create, add to, and view a student records text file. The main menu function displays boxes and labels for navigation and information. Option functions ask yes/no questions for confirming file resets or additions. Record data is read from and written to a file with functions for the menu options.

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/ 7

#include <utility.

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

void exitscreen() // Screen 4


{
clearportion(61,10,111,22);

// Background
fillscreen(61,10,111,22,177);

// Submarine
fillscreen(66,13,106,19,219);

// Side Submarine
fillscreen(66,13,68,13,177);
fillscreen(66,14,67,14,177);
fillscreen(66,15,66,15,177);

fillscreen(66,19,68,19,177);
fillscreen(66,18,67,18,177);
fillscreen(66,17,66,17,177);

fillscreen(106,14,106,14,177);
fillscreen(104,15,106,15,177);
fillscreen(102,16,106,16,177);
fillscreen(100,17,106,17,177);
fillscreen(98,18,106,18,177);
fillscreen(96,19,106,19,177);

// Nails
fillscreen(69,13,69,19,178);
fillscreen(95,13,95,19,178);

// Sides
fillscreen(69,21,95,21,196);
fillscreen(69,20,69,21,179);
fillscreen(95,20,95,21,179);
fillscreen(69,21,69,21,192);
fillscreen(95,21,95,21,217);

printxy(78,16,"Too Deepz");
printxy(79,14,"We Dive");
gotoxy(100,29);

getch();
clearportion(61,10,111,22);

printxy(75,17,"Thankz You Very Much Ye");


printxy(64,10," -^- ");
printxy(62,11,"(* v-v *)");
printxy(90,10," -^- ");
printxy(88,11,"(* v-v *)");
printxy(100,11," -^- ");
printxy(98,12,"(* v-v *)");

fillscreen(61,15,111,15,3);

printxy(74,13," -^- ");


printxy(72,14,"(* v-v *)");
printxy(63,16," -^- ");
printxy(61,17,"(* v-v *)");
printxy(65,19," -^- ");
printxy(63,20,"(* v-v *)");

printxy(100,13," -^- ");


printxy(98,14,"(* v-v *)");
printxy(102,16," -^- ");
printxy(100,17,"(* v-v *)");
printxy(100,19," -^- ");
printxy(98,20,"(* v-v *)");

fillscreen(61,21,111,21,3);
printxy(81,22,"Roar!!!!!");
gotoxy(100,29);

getch();
system("cls");
}

void mainmenu() // Screen 1


{
//Title
line2(4,2,114,24);
line1(6,3,112,7);
printxy(38,4,"Polytechnic University of the Philippines");
printxy(50,5,"San Juan Campus");
printxy(51,6,"San Juan City");

//First Box
line1(6,9,54,23);
printxy(13,14,"A) Create a new file");
printxy(13,16,"B) Add A Record");
printxy(13,18,"C) Browse");
printxy(13,20,"D) Close");
printxy(21,22,"Select An Option:");

// Main Menu
line1(12,10,48,12);
printxy(26,11,"Main Menu");

// Second Box
line1(60,9,112,23);
printxy(82,15,"Programmed");
printxy(86,17,"By");
printxy(77,19,"Carl Louie A. Semera");

// Third Box
line1(3,26,115,28);
// Indicator
gotoxy(39,22);gets;

void optiona() // Option A Yes or No Question


{
clearportion(5,27,114,27);
printxy(20,27,"Warning!!! Do you want to Reset your File?
(Y/N):");
gotoxy(69,27);
}

void optionb() // Option B Yes or No Question


{
clearportion(5,27,114,27);
printxy(42,27,"Do you want to add more? (Y/N):");
gotoxy(74,27);
}

main()
{
// Variables
char lastname[15],firstname[15],MidI[5],SNumber[20],program=' ',ans=' ';
int y,x;

// Main Functions
while(ans!='D')
{

mainmenu();
ans=toupper(getch());

//Function A
if(ans=='A')
{
char orn=' ';
//1st functions of A
while (orn!='N')
{
optiona();
orn=toupper(getch());

//2nd functions of A
if (orn=='Y')
{
fclose(fopen("StudentStorage.txt","w"));
clearportion(5,27,114,27);
printxy(44,27,"Your file has been Created");
break;
}

else if (orn!='N')
{
clearportion(5,27,114,27);
printxy(36,27,"You Have Input An Error Message, Press Any
Key");
getch();
optiona();
}

else if (orn=='N')
{

clearportion(5,27,114,27);
printxy(44,27,"Your file has not been deleted");
}
}
mainmenu();
}

//Function B
else if(ans=='B')
{
clearportion(7,27,100,27);
clearportion(61,10,111,22);
line1(60,9,112,23);

FILE *fp;
fp=fopen("StudentStorage.txt","a");
{
printxy(67,12,"Student Number:");
printxy(67,14,"Last Name:");
printxy(67,16,"First Name:");
printxy(67,18,"M.I:");

printxy(67,20,"Program Code: ");

gotoxy(83,12);scanf("\n");gets(SNumber);
gotoxy(78,14);gets(lastname);
gotoxy(79,16);gets(firstname);
gotoxy(72,18);gets(MidI);
gotoxy(81,20);scanf("\
n"),scanf("%c",&program);

fprintf(fp,"\n%s %s %s %s
%c",SNumber,lastname,firstname,MidI,program);

char ornz=' ';

//1st functions of B
while(ornz!='N')
{
optionb();
ornz=toupper(getch());

//2nd functions of B
if(ornz=='Y')
{
clearportion(5,27,114,27);
clearportion(61,10,111,22);
printxy(67,12,"Student Number:");
printxy(67,14,"Last Name:");
printxy(67,16,"First Name:");
printxy(67,18,"M.I:");

printxy(67,20,"Program Code: ");


gotoxy(83,12);scanf("\n");gets(SNumber);
gotoxy(78,14);gets(lastname);
gotoxy(79,16);gets(firstname);
gotoxy(72,18);gets(MidI);
gotoxy(81,20);scanf("\
n"),scanf("%c",&program);
fprintf(fp,"\n%s %s %s %s
%c",SNumber,lastname,firstname,MidI,program);
}

else
clearportion(5,27,114,27);
printxy(44,27,"You Have Input Error
Message");
optionb();

}
fclose(fp);
system("cls");
printxy(46,27,"Your file has been updated");
mainmenu();
}
}

else if(ans=='C')

{
//3rd Screen
system("cls");
printxy(38,2,"Polytechnic University of the Philippines");
printxy(50,3,"San Juan Campus");
printxy(51,4,"San Juan City");
printxy(1,6,"Page:");
printxy(20,8,"#");
printxy(28,8,"Student #");
printxy(52,8,"Student Name");
printxy(80,8,"Program");
fillscreen(16,9,92,9,61);

FILE *fp;
fp=fopen("StudentStorage.txt","r");
// Declaration for Final
int displaycount=1,pagecount=1,incromentz=1,nextpage=0;
int acc=0,bus=0,com=0,oc=0;
int x;
//1st functions of C
while(fscanf(fp,"\n%s %s %s %s
%c",SNumber,lastname,firstname,MidI,&program)!=EOF)
{

//Condition For Data Count


if (nextpage==3)
{
getch();
incromentz=1;
pagecount=2;
clearportion(1,10,100,30);
}
else if (nextpage==4)
{
incromentz=2;
}
else if (nextpage==6)
{
getch();
incromentz=1;
pagecount=3;
clearportion(1,10,100,30);
}
else if (nextpage==7)
{
incromentz=2;
}
else if (nextpage==9)
{
getch();
incromentz=1;
pagecount=4;
clearportion(1,10,100,30);
}

else if (nextpage==10)
{
incromentz=2;

}
else if (nextpage==12)
{
clearportion(1,10,100,30);
getch();
incromentz=1;
pagecount=5;
clearportion(1,10,100,30);
}

gotoxy(7,6);printf("%d",pagecount);
gotoxy(20,10+incromentz);printf("%d",displaycount);
gotoxy(28,10+incromentz);printf("%s",SNumber);
gotoxy(47,10+incromentz);printf("%s, %s
%s.",lastname,firstname,MidI);

incromentz++;
displaycount++;
nextpage++;

//2nd functions of C
program=toupper(program);
if(program=='A')

{printxy(80,9+incromentz,"Accounting");
acc++;}
else if(program=='B')

{printxy(80,9+incromentz,"Business");
bus++;}
else if(program=='C')
{printxy(80,9+incromentz,"Computer");
com++;}
else

{printxy(80,9+incromentz,"Errorz");
oc++;}
}

fclose(fp);
printxy(2,18,"Total no. students: ");gotoxy(22,18);printf("%d",--
displaycount);
printxy(10,19,"Accounting: ");gotoxy(22,19);printf("%d",acc);
printxy(12,20,"Business: ");gotoxy(22,20);printf("%d",bus);
printxy(12,21,"Computer: ");gotoxy(22,21);printf("%d",com);
printxy(5,22,"Invalid courses: ");gotoxy(22,22);printf("%d",oc);
getch();
system("cls");
}

else // Error Message


{
clearportion(5,27,114,27);
printxy(42,27,"You Have Input Error Message");
mainmenu();
}
}
// Output of End of Looping and 4th Screen (Option D)
clearportion(5,27,114,27);
printxy(45,27,"Thank You for Testing :))");
exitscreen();

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy