You are on page 1of 4

// SET B

#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(80,16,"Titan");
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;

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

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

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

if(ans=='A')
{
fclose(fopen("Storage.txt", "w"));
printxy(45,27,"Your file has now been reset");
mainmenu();

else if(ans=='B') // Screen 2


{

clearportion(7,27,100,27);
clearportion(61,10,111,22);
line1(60,9,112,23);

FILE *fp;
fp=fopen("Storage.txt","a");
for(x=0;x<=2;x++)
{
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("%d",&program);

fprintf(fp,"\n%s %s %s %s
%d",SNumber,lastname,firstname,MidI,program);
clearportion(61,10,111,22);
}

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

else if(ans=='C') // Screen 3

{
system("cls");
printxy(38,3,"Polytechnic University of the Philippines");
printxy(50,4,"San Juan Campus");
printxy(51,5,"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("Storage.txt","r");

while(fscanf(fp,"\n%s %s %s %s
%d",SNumber,lastname,firstname,MidI,&program)!=EOF)
{

printf("\n\t\t\t%s",SNumber);
printf("\t\t%s %s %s",lastname,firstname,MidI);
printf("\t\t\t%d",program);

fclose(fp);
getch();
system("cls");
mainmenu();
}

else if(ans=='D') // Error Message


{
break;
}
else
{
printxy(42,27,"You Have Input Error Message");
mainmenu();
}
}
clearportion(7,27,100,27);
exitscreen();

You might also like