Escolar Documentos
Profissional Documentos
Cultura Documentos
Submitted in partial fulfillment of the Requirement for the award of the degree of
Bachelor of technology
BPUT, BBSR
20XX-20XX
Mr.Xxxxx Xxxxxx
(Project Leader)
Date:
ACKNOWLEDGEMET
We also owe our gratitude to Mr. Xxxxx Xxxx our Project Coordinator for
his kind guidance, and enabling us to complete our project.
Date:
Place:
Table of Contents
Sl. No Page
1. Introduction 00
o Project Title
00
o A Bird View
00
o Strict Schedule
00
o Introduction to Project
00
o Organization Profile
00
o Purpose of the System
00
o Quick View
00
2. Software and Platform Used 00
o C++ 00
3. Program 00
4. System Testing 00
o Testing Methodology 00
o Unit Testing 00
o White Box Testing 00
o Conditional Testing 00
o Loop Testing 00
o Validation Testing 00
o Black Box Testing 00
o Performance and Acceptance Testing 00
o System Testing 00
5. Conclusion 00
o Merits of the Project 00
o Limitations of the Project 00
o Future Extension 00
TITLE:
A BIRDS’ EYEVIEW:
First we have created a user defined data type. In this data type we define
further different sub data types, which were used effectively in this program.
2. Filing:
In this program we restrict our primary key to one field only i.e. G.R.no,
which is unique throughout the program. Hence, through this tool we were
successful to overcome the duplicity phenomenon. This factor is discussed
in detail later in ‘ADDREC’ function.
Autonomous Password Function:
This function enables us to edit records. We can edit only those records,
which already exists in the data base. Than G.R.no. is asked, so that it can
display required record for editing. When the required record is displayed
you can than edit the fields you want to and after saving the changes you can
than return to main menu.
DELETE RECORD():
Through this function we can delete the required record by specifying the
corresponding G.R.no. after that the record is destroyed.
PASS();
Through this function we can create a password program. In this password
pragram input character is replaced by ‘*’ automatically. For this purpose
we use strcmp() function.
ADD_USER();
The administrator only accesses this function. He will add users with the
help of this function by assigning him a unique name and password and
saving his name and password in the file userfile.dat..
DELETE_USER ();
Administrator will delete the user by deleting his name and password from
the file userfile.dat so that he will not be able to access the records of
students again.
DISPLAY_USER ();
Administrator uses this function to see the names and passwords of
authorized user.
6. Filing.
We have used two different files in this project.
1. student.dat
2. userfile.dat
In student.dat, administrator will record all the information of the student.
The information of the student is recorded by saving following
characteristics of students. We name these characteristics as different fields.
1. Roll number.
2. Name.
3. Father’s Name.
4. Gender.
5. Address.
6. Phone number.
7. Date of admission
8. Class.
8. Authorized users:
Users are persons with unique usernames and passwords and can access
the records of students saved in the file student.dat. The administrators who
manage their ID and passwords in the file user.dat add them. Their access is
limited as they can only look in the record or can only search for the
specified record.
9. Security aspect:
Since security is one of the important building blocks of a database therefore
from beginning we put stress on this issue. Since our administration database
is a computer base therefore we did not use any specified encryption
algorithm as in networks however we use .dat format to save our data, which
is unable to access.
ORGANIZATION PROFILE
Software Solutions is an IT solution provider for a dynamic environment
where business and technology strategies converge. Their approach focuses
on new ways of business combining IT innovation and adoption while also
leveraging an organization’s current IT assets. Their work with large global
corporations and new products or services and to implement prudent
business and technology strategies in today’s environment.
1. A First Program
2. Loops
3. Symbolic Constants
4. Conditionals
5. Pointers
6. Arrays
7. Character Arrays
8. Functions
9. File
10. Command-line Arguments
11. Graphical Interfaces: Dialog Boxes
1. A First Program
Let's be polite and start by saluting the world! Type the following
program into your favorite editor:
void main()
{
printf("\nHello World\n");
}
void main()
{
printf("\n");
printf("Hello World");
printf("\n");
}
Try leaving out the “\n” lines and see what happens. The first
statement “#include <stdio.h>” “#include <iostream.h>” includes a
specification of the C++ I/O library. All variables in C++ must be
explicitly defined before use: the “.h” files are by convention “header
files” which contain definitions of variables and functions necessary for
the functioning of a program, whether it be in a user -written section of
code, or as part of the standard C++ libaries. The directive “#include”
tells the C++ compiler to insert the contents of the specified file at
that point in the code. The “< ...>” notation instructs the compiler to
look for the file in certain “standard” system directories. The void
preceeding “main” indicates that main is of “void” type--that is, it has
no type associated with it, meaning that it cannot return a result on
execution. The “;” denotes the end of a statement. Blocks of
statements are put in braces {...}, as in the definition of functions. All
C++ statements are defined in free format, i.e., with no specified
layout or column assignment. Whitespace (tabs or spaces) is never
significant, except inside quotes as part of a character string. The
following program would produce exactly the same result as our earlier
example:
void main()
{
printf("\nHello World\n");
}
2. Loops
Most real programs contain some construct that loops within the
program, performing repetitive actions on a stream of data or a region
of memory. There are several ways to loop in C++. Two of the most
common are the while loop:
while (expression)
{
...block of statements to execute...
}
and the for loop:
for (expression_1; expression_2; expression_3)
{
...block of statements to execute...
}
expression_1;
while (expression_2)
{
...block of statements...
expression_3;
}
For instance, the following structure is often
encountered:
i = initial_i;
while (i <= i_max)
{
...block of statements...
i = i + i_increment;
}
This structure may be rewritten in the easier syntax of
the for loop as:
for (i = initial_i; i <= i_max; i = i + i_increment)
{
...block of statements.. .
}
Infinite loops are possible (e.g. for(;;)), but not too good for your
computer budget! C++ permits you to write an infinite loop, and
provides the break statement to “breakout “ of the loop. For example,
consider the following (admittedly not -so-clean) re-write of the
previous loop:
angle_degree = 0;
for ( ; ; )
{
...block of statements...
angle_degree = angle_degree + 10;
if (angle_degree == 360) break;
}
3. Symbolic Constants
You can define constants of any type by using the #define compiler
directive. Its syntax is simple –for instance
#define ANGLE_MIN 0
#define ANGLE_MAX 360
4. Conditionals
if (conditional_1)
{
...block of statements executed if conditional_1 is
true...
}
else if (conditional_2)
{
...block of statements executed if conditional_2 is
true...
}
else
{
...block of statements executed othe rwise...
}
and any variant that derives from it, either by omitting branches or by
including nested conditionals. Conditionals are logical operations
involving comparison of quantities (of the same type) using the
conditional operators:
switch (expression)
{
case const_expression_1:
{
...block of statements...
break;
}
case const_expression_2:
{
...block of statements...
break;
}
default:
{
...block of statements..
}
}
5. Pointers
The C++ language allows the programmer to “peek and poke” directly
into memory locations. This gives great flexibility and power to the
language, but it also one of the great hurdles that the beginner must
overcome in using the language. All variables in a program reside in
memory; the statements float x; x = 6.5; request that the compiler
reserve 4 bytes of memo ry (on a 32-bit computer) for the floating
-point variable x, then
put the “value” 6.5 in it. Sometimes we want to know where a variable
resides in memory. The address (location in memory) of any variable is
obtained by placing the operator “&” before its name. Therefore &x is
the address of x. C++ allows us to go one stage further and define a
variable, called a pointer, that contains the address of (i.e. “points to”)
other variables. For example:
float x;
float* px;
x = 6.5;
px = &x;
char* pc;
float* px;
float x;
x = 6.5;
px = &x;
pc = (char*) px;
(the (char*) in the last line is a “cast”, which converts one data type to
another), px and pc both point to the same location in memory --the
address of x--but px + 1and pc + 1 point to different memory
locations. Consider the following simple code.
void main()
{
float x, y; /* x and y are of
float type */
float *fp, *fp2; /* fp and fp2 are pointers
to float */
x = 6.5; /* x now contains the
value 6.5 */
/* print contents and
address of x */
printf("Value of x is %f, address of x %ld \n", x, &x);
fp = &x; /* fp now points to
location of x */
/* print the contents of fp */
printf("Value in memory l ocation fp is %f\n", *fp);
/* change content of
memory location */
*fp = 9.2;
printf("New value of x is %f = %f \n", *fp, x);
/* perform arithmetic
*/
*fp = *fp + 1.5;
printf("Final value of x is %f = %f \n", *fp, x);
/* transfer values
*/
y = *fp;
fp2 = fp;
printf("Transfered value into y = %f and fp2 = %f \n",
y, *fp2);
}
Run this code to see the results of these different operations. Note
that, while the value of a pointer ( if you print it out with printf) is
typically a large integer, denoting some particular memory location in
the computer, pointers are not integers--they are a
completely different data type.
6. Arrays
type name[dim];
#define SIZE 3
void main()
{
float x[SIZE];
float *fp;
int i;
/* initialize the array x
*/
/* use a "cast" to force i
*/
/* into the equivalent float
*/
for (i = 0; i < SIZE; i++)
x[i] = 0.5*(float)i;
/* print x */
for (i = 0; i < SIZE; i++)
printf(" %d %f \n", i, x[i]);
/* make fp point to array x
*/
fp = x;
/* print via pointer
arithmetic */
/* members of x are
adjacent to */
/* each other in memory */
/* *(fp+i) refers to content
of */
/* memory location (fp+i)
or x[i] */
for (i = 0; i < SIZE; i++)
printf(" %d %f \n", i, *(fp+i));
}
(The expression ``i++'' is C shorthand for ``i = i + 1''.) Since x[i]
means the i-th element of the array x, and fp = x points to the start of
the x array, then *(fp+i) is the content of the memory address i
locations beyond fp, that is, x[i].
7. Character Arrays
printf("Hello, world\n");
printf("The value of a is: %f \n", a);
String constants can be associ ated with variables. C++ provides the
char type variable, which can contain one character--1 byte--at a time.
A character string is stored in an array of character type, one ASCII
character per location. Never forget that, since strings are
conventionally terminated by the null character “\0”, we require one
extra storage location in the array! C++ does not provide any operator
which manipulates entire strings at once. Strings are manipulated
either via pointers or via special routines available from the standard
string library string.h. Using character pointers is relatively easy since
the name of an array is a just a pointer to its first element.
8. Functions
Run this code and observe that a and b are NOT exchanged! Only the
copies of the arguments are exchanged. The RIGHT way to do this is of
course to use pointers:
ios
istream ostream
iostream
For example, the following statement opens a file named “result” for
output:
It is very easy to read from or write to a text file. Simply use the <<
and >> operators the same way you do when performing console I/O,
except that instead of using cin and cout, substitute a stream that is
linked to a file.
Sequential Input And Output Operations:
The functions write() and read() , unlike the functions put() and
get(), handle the data in binary form. This means that the values are
stored in the disk file in the same format in which they are stored in
the internal memory.
These functions take tow arguments. The first is the address of the
variable v, and the second is the length of that variable in bytes. The
address of the variable must be cast to type char*.
Suppose you don't want to deal with command line interpretation, but
you still want your program to be able to change the values of certain
variables in an interactive way. You could simply program in a series
printf/scanf lines to quiz the user about their preferences:
...
printf("Please enter the value of n: ");
scanf("%d", &n);
printf("Please enter the value of x: ");
scanf("%f", &x);
...
and so on, but this won't work well if your program is to be used as
part of a pipeline (see the UNIX primer), for example using ther
graphics program plot_data, since
the questions and answers will get mixed up with the data stream. A
convenient alternative is to use a simple graphical interface which
generates a dialog box, offering you the option of varying key
parameters in your program. Our graphics package provides a number
of easy -to-use tools for constructing and using such boxes. The
simplest way to set the integer variabl e n and the float variable x (i.e.
to perform the same effect as the above lines of code) using a dialog
box is as follows:
Compile this program using the alias Cgfx (see the page on
compilation) to link in all necessary libraries. The two create lines
define the entries in the box and the variables to be associated with
them; set_up_dialog names the box and defines its location. Finally,
read_dialog_window pops up a window and allows you to change the
values of the variables. When the program runs, you will see a box that
looks someth ing like this:
Modify the numbers shown, click "OK" (or just hit carriage return), and
the changes are made. That's all there is to it! The great advantage of
this approach is that it operates independently of the flow of data
through stdin/stdout. In principle, you could even
Control the operation of every stage in a pipeline of many chained
commands, using a separate dialog box for each.
Progam
int initmouse();
void showmouseptr();
int restrictmouseptr(int x1,int y1,int x2,int y2);
void getmousepos(int *button,int *x,int *y);
struct user
{
char username[12],userpswd[12];
};
FILE *usrptr;
struct user usrrec;
struct student
{
int rno;
char
name[50],clas[50],f_name[50],ph[8],adrs[50],date[15];
char gender;
};
fptr=fopen("student.dat","rb+");
if (fptr==NULL)
{
fptr=fopen("student.dat","wb+");
if (fptr==NULL)
{
printf("\n Can't create file");
getch();
exit(1);
}
}
if (initmouse()==0)
{
closegraph();
restorecrtmode();
printf("\nMouse driver not loaded");
exit(1);
}
usrptr=fopen("userfile.dat","rb+");
if(usrptr==NULL)
{
usrptr=fopen("userfile.dat","wb+");
if(usrptr==NULL)
{
printf("SORRY CANNOT CREATE USER FILE");
return;
}// end if
}// end if
splash();
int gd=DETECT,gm,errorcode,xc,yc;
initgraph(&gd,&gm,"c:\\tc\\bgi");
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s\n",
grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
cleardevice();
setbkcolor(1);
int menu=13;
char op;
while(menu==13)
{
cleardevice();
setcolor(5);
showmouseptr();
rectangle(70,55,280,80);gotoxy(10,5); printf("1-->LOGIN
AS ADMINISTRATOR");
rectangle(70,90,280,115);gotoxy(10,7); printf("2--
>LOGIN AS USER");
rectangle(70,125,280,150);gotoxy(10,9); printf("3--
>EXIT");
while(!kbhit())
{
showmouseptr();
getmousepos(&button,&xc,&yc);
if (((button & 1)==1)&&(xc>70&&xc<280)&&(yc>55&&yc<80))
{
administrator();cleardevice();
}
if (((button &
1)==1)&&(xc>70&&xc<280)&&(yc>90&&yc<115))
{
user_menu();cleardevice();
}
if (((button &
1)==1)&&(xc>70&&xc<280)&&(yc>125&&yc<150))
{
end_splash();cleardevice();exit(0);
}
}//end while
}
void administrator(void)
{
char ch;
int c=Pass(),xc,yc;
if(c==0)
return;
int menu=13;
while (menu==13)
{
cleardevice();
for (x=68,y=3;x<=40,y<=31;x--,y++)
{
gotoxy(y,3);printf(" DISPLAY ");
gotoxy(x,3);printf(" MAIN MENU ");
delay(15);
}
setcolor(5);
showmouseptr();
rectangle(160,55,400,80);gotoxy(22,5);printf("1-->ADD
RECORD");
rectangle(160,90,400,115);gotoxy(22,7);printf("2--
>EDIT RECORD");
rectangle(160,120,400,145);gotoxy(22,9);printf("3--
>DISPLAY SINGLE RECORD");
rectangle(160,155,400,180);gotoxy(22,11);printf("4--
>DISPLAY ALL RECORDS");
rectangle(160,185,400,210);gotoxy(22,13);printf("5--
>DELETE RECORD");
rectangle(160,215,400,240);gotoxy(22,15);printf("6--
>ADD USER");
rectangle(160,245,400,280);gotoxy(22,17);printf("7--
>DISPLAY ALL USERS");
rectangle(160,285,400,310);gotoxy(22,19);printf("8--
>DELETE USER");
rectangle(160,315,400,345);gotoxy(22,21);printf("9--
>LOG OFF ADMINISTRATOR");
gotoxy(22,23);printf(" Enter your Choice <1 TO
9> : ");
while (!kbhit())
{
showmouseptr();
getmousepos(&button,&xc,&yc);
if (((button &
1)==1)&&(xc>160&&xc<400)&&(yc>55&&yc<80))
{
add_rec();break;
}
if (((button &
1)==1)&&(xc>160&&xc<400)&&(yc>90&&yc<115))
{
edit_rec();break;
}
if (((button &
1)==1)&&(xc>160&&xc<400)&&(yc>120&&yc<145))
{
display_single_rec();break;
}
if (((button &
1)==1)&&(xc>160&&xc<400)&&(yc>155&&yc<180))
{
display_all_rec();break;
}
if (((button &
1)==1)&&(xc>160&&xc<400)&&(yc>185&&yc<210))
{
delete_rec();break;
}
if (((button &
1)==1)&&(xc>160&&xc<400)&&(yc>215&&yc<240))
{
add_user();break;
}
if (((button &
1)==1)&&(xc>160&&xc<400)&&(yc>245&&yc<280))
{
display_user();break;
}
if (((button &
1)==1)&&(xc>160&&xc<400)&&(yc>285&&yc<310))
{
delete_user();break;
}
}
ch=getch();
getche();
switch(ch)
{
case '1':add_rec(); break;
case '2':edit_rec(); break;
case '3':display_single_rec(); break;
case '4':display_all_rec(); break;
case '5':delete_rec(); break;
case '6':add_user(); break;
case '7':display_user(); break;
case '8':delete_user(); break;
case '9':return;
} // end switches
for (x=68,y=3;x<=38,y<=31;x--,y++)
{
gotoxy(y,3);printf(" DISPLAY ");
gotoxy(x,3);printf(" Add RECORD MENU ");
delay(15);
}
char srec;
rewind (fptr);
while (fread(&rec,sizeof(rec),1,fptr)==1);
{
if (srec==rec.rno)
{
gotoxy(5,23);printf("Sorry! This Record Already
Exist");
gotoxy(5,24);printf("PRESS ANY KEY TO CONTINUE");
getch();
return;
}// end if
}// end while
rec.rno=atoi(t);
gotoxy(10,7); printf("ENTER NAME
> ");
gets(rec.name);
gotoxy(10,9); printf("ENTER FATHER'S NAME
> ");
gets(rec.f_name);
gotoxy(10,11);printf("ENTER GENDER(M/F)
> ");
rec.gender=getche();
if ((rec.gender=='M'||rec.gender=='m')||
(rec.gender=='F'||rec.gender=='f'))
printf("%c",rec.gender);
scanf("%c",&ch);
gotoxy(10,13);printf("ENTER CLASS
> ");
gets(rec.clas);
gotoxy(10,15);printf("ENTER ADDRESS
> ");
gets(rec.adrs);
gotoxy(10,17);printf("ENTER PHONE #
> ");
gets(rec.ph);
gotoxy(10,19);printf("ENTER DATE OF
ADMISSION(DD/MM/YY)> ");
gets(rec.date);
gotoxy(15,21);printf("Do You Want To Save This Record
(Y/N) : ");
ch=getch();
if(ch=='Y' || ch=='y')
{
fwrite(&rec,sizeof(rec),1,fptr);
gotoxy(15,23);printf("RECORD SAVED ");
gotoxy(15,24);printf("PRESS ANY KEY TO CONTINUE");
getch();
cleardevice();
}
void edit_rec(void)
{
int Erec=0, found=0;
char t[50],ch,ch1;
long int s;
cleardevice();
for(x=60,y=3;x>=40,y<=25;x--,y++)
{
cleardevice();
gotoxy(y,2); printf("DISPLAY EDIT");
gotoxy(x,2); printf("RECORD MENU");
delay(50);
}// end for loop
gotoxy(10,5); printf("ENTER G.R.NO. FOR EDITING : ");
gets(t); Erec=atoi(t);
Ag3:
{
rewind(fptr);
while(fread(&rec,sizeof(rec),1,fptr)==1)
{
if(rec.rno==Erec)
{
cleardevice();
found=1;
for(x=60,y=3;x>=40,y<=25;x--,y++)
{
cleardevice();
gotoxy(y,2); printf("DISPLAY EDIT");
gotoxy(x,2); printf("RECORD MENU");
delay(50);
}// end for loop
gotoxy(10,5);
printf("G.R.NO. : %d",rec.rno);
gotoxy(10,6);
printf("NAME : %s ",rec.name);
gotoxy(10,7);
printf("FATHER'S NAME : %s",rec.f_name);
gotoxy(10,8);
printf("CLASS : %s",rec.clas);
gotoxy(50,8);
printf("GENDER : %c",rec.gender);
gotoxy(10,9);
printf("RESIDENTIAL ADDRESS : %s",rec.adrs);
gotoxy(10,10);
printf("PHONE : %s",rec.ph);
gotoxy(10,11);
printf("DATE OF ADMISSION : %s",rec.date);
gotoxy(15,13);
printf("EDIT THIS RECORD CHOOSE (1 TO 9) : ");
gotoxy(15,15);printf("1->ENTER NEW G.R.NO.");
gotoxy(15,16);printf("2->ENTER NEW NAME");
gotoxy(15,17);printf("3->ENTER NEW FATHER'S
NAME");
gotoxy(15,18);printf("4->ENTER NEW CLASS");
gotoxy(15,19);printf("5->ENTER NEW GENDER");
gotoxy(15,20);printf("6->ENTER NEW RESIDENTIAL
ADDRESS");
gotoxy(15,21);printf("7->ENTER NEW PHONE");
gotoxy(15,22);printf("8->ENTER NEW DATE OF
ADMISSION");
gotoxy(15,23);printf("9->EXIT TO EDIT MENU");
ch=getch();
switch(ch)
{
case '1':
char temp[4];
char ser;
rewind (fptr);
gotoxy(10,25);printf("Enter New G.R.No.
: ");
gets(temp);
ser=atoi(temp);
while
(fread(&rec,sizeof(rec),1,fptr)==1);
{
if (ser==rec.rno)
{
gotoxy(15,27);printf("Sorry! This
G.R.No Already Exist. Delete First...");
gotoxy(15,28);printf("PRESS ANY
KEY TO CONTINUE....");
getch();
return;
}// end if
}// end while
rec.rno=atoi(temp);
s=sizeof(rec); //finding the size of
rec
fseek(fptr,-s,SEEK_CUR); //setting
pointer in file1
fwrite(&rec,sizeof(rec),1,fptr);
gotoxy(15,26);
printf("RECORD SAVED");
gotoxy(15,27);
printf("PRESS ANY KEY TO CONTINUE");
getch();
goto Ag3;
break;
case '2':
gotoxy(10,25);printf("Enter New Name :
");
gets(rec.name);
s=sizeof(rec); //finding the size of
rec
fseek(fptr,-s,SEEK_CUR); //setting
pointer in file1
fwrite(&rec,sizeof(rec),1,fptr);
gotoxy(15,27);
printf("RECORD SAVED");
gotoxy(15,28);
printf("PRESS ANY KEY TO CONTINUE");
getch();
goto Ag3;
break;
case '3':
gotoxy(10,25);printf("Enter New
Father's Name : ");
gets(rec.f_name);
s=sizeof(rec); //finding the size of
rec
fseek(fptr,-s,SEEK_CUR); //setting
pointer in file1
fwrite(&rec,sizeof(rec),1,fptr);
gotoxy(15,27);
printf("RECORD SAVED");
gotoxy(15,28);
printf("PRESS ANY KEY TO CONTINUE");
getch();
goto Ag3;
break;
case '4':
gotoxy(10,25);printf("Enter New Class :
");
gets(rec.clas);
s=sizeof(rec); //finding the size of
rec
fseek(fptr,-s,SEEK_CUR); //setting
pointer in file1
fwrite(&rec,sizeof(rec),1,fptr);
gotoxy(15,27);
printf("RECORD SAVED");
gotoxy(15,28);
printf("PRESS ANY KEY TO CONTINUE");
getch();
goto Ag3;
break;
case '5':
gotoxy(10,25);printf("Enter New
Gender : ");
rec.gender=getche();
if ((rec.gender=='M'||
rec.gender=='m')||(rec.gender=='F'||rec.gender=='f'))
printf("%c",rec.gender);
scanf("%c",&ch1);
s=sizeof(rec); //finding the size of
rec
fseek(fptr,-s,SEEK_CUR); //setting
pointer in file1
fwrite(&rec,sizeof(rec),1,fptr);
gotoxy(15,27);
printf("RECORD SAVED");
gotoxy(15,28);
printf("PRESS ANY KEY TO CONTINUE");
getch();
goto Ag3;
break;
case '6':
gotoxy(10,25);printf("Enter New
Residential Address : ");
gets(rec.adrs);
s=sizeof(rec); //finding the size of
rec
fseek(fptr,-s,SEEK_CUR); //setting
pointer in file1
fwrite(&rec,sizeof(rec),1,fptr);
gotoxy(15,27);
printf("RECORD SAVED");
gotoxy(15,28);
printf("PRESS ANY KEY TO CONTINUE");
getch();
goto Ag3;
break;
case '7':
gotoxy(10,25);printf("Enter New Phone :
");
gets(rec.ph);
s=sizeof(rec); //finding the size of
rec
fseek(fptr,-s,SEEK_CUR); //setting
pointer in file1
fwrite(&rec,sizeof(rec),1,fptr);
gotoxy(15,27);
printf("RECORD SAVED");
gotoxy(15,28);
printf("PRESS ANY KEY TO CONTINUE");
getch();
goto Ag3;
break;
case '8':
gotoxy(10,25);printf("Enter New Date of
Addmission : ");
gets(rec.date);
s=sizeof(rec); //finding the size of
rec
fseek(fptr,-s,SEEK_CUR); //setting
pointer in file1
fwrite(&rec,sizeof(rec),1,fptr);
gotoxy(15,27);
printf("RECORD SAVED");
gotoxy(15,28);
printf("PRESS ANY KEY TO CONTINUE");
getch();
goto Ag3;
break;
case '9':
return;
}
}
}
}
if(found==0)
{
gotoxy(15,21); printf("NO RECORD FOUND");
gotoxy(15,22); printf("PRESS ANY KEY TO CONTINUE");
getch();
}
}//end body of edit user
void display_single_rec(void)
{
int srec=0,found=0;
char t[5];
cleardevice();
for (x=60,y=3;x<=30,y<=31;x--,y++)
{
gotoxy(y,3);printf(" DISPLAY ");
gotoxy(x,3);printf(" SINGLE RECORD MENU ");
delay(15);
}
while (fread(&rec,sizeof(rec),1,fptr)==1)
{
if (rec.rno==srec)
{
cleardevice();
for (x=60,y=3;x<=30,y<=31;x--,y++)
{
gotoxy(y,3);printf(" DISPLAY ");
gotoxy(x,3);printf(" SINGLE RECORD MENU ");
delay(15);
}
found=1;
gotoxy(10,7); printf("NAME : %s ",rec.name);
gotoxy(50,7); printf("G.R.NO. : %d",rec.rno);
gotoxy(10,9); printf("FATHER'S NAME :
%s",rec.f_name);
gotoxy(10,11);printf("CLASS : %s",rec.clas);
gotoxy(50,11);printf("GENDER : %c",rec.gender);
gotoxy(10,13);printf("RESIDENTIAL ADDRESS :
%s",rec.adrs);
gotoxy(10,15);printf("PHONE : %s",rec.ph);
gotoxy(10,17);printf("DATE OF ADMISSION :
%s",rec.date);
}
if (found==0)
{
gotoxy(15,22);printf("RECORD NOT FOUND");
gotoxy(15,23);printf("PRESS ANY KEY TO CONTINUE");
getch();
cleardevice();
}
void display_all_rec(void)
{
rewind(fptr);
while(fread(&rec,sizeof(rec),1,fptr)==1)
{
cleardevice();
for (x=68,y=3;x<=38,y<=31;x--,y++)
{
gotoxy(y,3);printf(" DISPLAY ");
gotoxy(x,3);printf(" All RECORD MENU ");
delay(15);
}
void delete_rec(void)
{
cleardevice();
int DRec=0,a,found=0;
char t[50],ch;
FILE *temp;
temp=fopen("temp.dat","wb+");
if (temp==NULL)
{
printf("\n Can't create File ");
getch();
exit(1);
}
cleardevice();
for (x=68,y=3;x<=38,y<=31;x--,y++)
{
gotoxy(y,3);printf(" DISPLAY ");
gotoxy(x,3);printf(" DEL RECORD MENU ");
delay(15);
}
for (x=68,y=3;x<=38,y<=31;x--,y++)
{
gotoxy(y,3);printf(" DISPLAY ");
gotoxy(x,3);printf(" DEL RECORD MENU ");
delay(15);
}
found=1;
gotoxy(10,7);printf ("NAME : %s ",rec.name);
gotoxy(50,7);printf ("G.R.NO. : %d",rec.rno);
gotoxy(10,9);printf("FATHER'S NAME : %s",rec.f_name);
gotoxy(10,11);printf("CLASS : %s",rec.clas);
gotoxy(50,11);printf("GENDER : %c",rec.gender);
gotoxy(10,13);printf("RESIDENTIAL ADDRESS :
%s",rec.adrs);
gotoxy(10,15);printf("PHONE : %s",rec.ph);
gotoxy(10,17);printf("DATE OF ADMISSION :
%s",rec.date);
}
else
{
fwrite(&rec,sizeof(rec),1,temp);
}
}
if (found==0)
{
gotoxy(50,22);printf("SORRY NO RECORD FOUNFD");
gotoxy(50,23);printf("Press Any Key to Continue");
getch();
cleardevice();
}
else
{
gotoxy(15,23);printf("DO U WANT TO DELETE THIS
RECORD.....Y/N");
ch=getche();
if (ch=='y' || ch=='Y')
{
fcloseall(); //Closing
All Files
remove("student.dat");
rename("temp.dat","student.dat");
fptr=fopen("student.dat","rb+"); //Again
opening Files
if (fptr==NULL)
{
fptr=fopen("student.dat","wb+");
if (fptr==NULL)
{
printf("\n cant create file");
getch();
}
}
}
}
}
void splash(void)
{
int driver=DETECT,mode;
//initialize graphics
initgraph(&driver,&mode,"c:\\tc\\bgi");
setbkcolor(1);
settextstyle(1,0,7);
outtextxy(200,60,"SCHOOL");
outtextxy(120,160,"AUTOMATION");
outtextxy(200,260,"SYSTEM");
delay(5555);
closegraph();
}
void user_menu(void)
{
cleardevice();
int check=check_user(); //variable check confirms the
existance of user
if(check!=0)
{
gotoxy(25,14); printf("INVALID USER");
gotoxy(25,16); printf("PRESS ANY KEY TO CONTINUE");
getch();
return;
}
int menu=13;
while(menu==13)
{
cleardevice();
rewind(fptr);
char op;
gotoxy(17,2); printf("USER MENU");
gotoxy(17,3); printf("---------");
gotoxy(13,5); printf("1-->DISPLAY SINGLE RECORD");
gotoxy(13,7); printf("2-->DISPLAY ALL RECORDS");
gotoxy(13,9); printf("3-->LOG OFF %s",name);
gotoxy(13,11); printf("ENTER YOUR CHOICE <1 TO 3> : ");
op=getch();
switch(op)
{
case '1': display_single_rec(); break;
case '2': display_all_rec(); break;
case '3': cleardevice(); return;
} //end switch cases
}//end while
}//end body of user_menu
void add_user(void)
{
cleardevice();
rewind(usrptr);
char confirm;
gotoxy(25,2); printf("ADD USER");
gotoxy(25,3); printf("--------");
gotoxy(5,5); printf("ENTER USER NAME : ");
gets(name);
strupr(name); // convert string to upper case
char *str=name;
while(fread(&usrrec,sizeof(usrrec),1,usrptr)==1)
{
char *s1=name,*s2=usrrec.username;
int check=strcmp(s1,s2);
if (check==0)
{
gotoxy(5,7); printf("USER ALREADY EXIST");
gotoxy(5,9); printf("PRESS ANY KEY TO CONTINUE");
getch();
cleardevice();
return;
}//end if
}//end while
strcpy(usrrec.username, str);
gotoxy(5,7); printf("ENTER PASSWORD : ");
gets(usrrec.userpswd);
gotoxy(5,9); printf("WISH TO SAVE USER (Y/N) : ");
confirm=getche();
if((confirm=='y')||(confirm=='Y'))
{
fwrite(&usrrec,sizeof(usrrec),1,usrptr);
gotoxy(5,11); printf("USER SAVED");
gotoxy(5,13); printf("PRESS ANY KEY TO CONTINUE");
getch();
}//end if
cleardevice();
rewind(usrptr);
} //end body of adduser
void display_user(void)
{
rewind(usrptr);
cleardevice();
gotoxy(25,2); printf("DISPLAY OF USERS");
gotoxy(25,4); printf("----------------");
while(fread(&usrrec,sizeof(usrrec),1,usrptr)==1)
{
gotoxy(10,5); printf("USER NAME : %s
",usrrec.username);
gotoxy(10,7); printf("PASSWORD : %s
",usrrec.userpswd);
gotoxy(10,9); printf("PRESS ANY KEY TO CONTINUE");
getch();
}//end while
cleardevice();
rewind(usrptr);
}//end body of displayuser
void delete_user(void)
{
rewind(usrptr);
cleardevice();
int a,check,found=1;
char confirm;
FILE *temp1;
temp1=fopen("temp1.dat","wb+");
if (temp1==NULL)
{
printf("\n ERROR IN DELETING THE RECORD");
getch();
return;
}
gotoxy(25,2); printf("DELETE USER");
gotoxy(25,3); printf("-----------");
gotoxy(10,5);printf("ENTER USER NAME FOR DELETION :
"); gets(name);
strupr(name);
rewind(usrptr);
char *str=name;
while(fread(&usrrec,sizeof(usrrec),1,usrptr)==1)
{
char *s1=name,*s2=usrrec.username;
int check=strcmp(s1,s2);
if(check==0)
{
gotoxy(10,7); printf("ARE YOU SURE YOU WANT TO
DELETE (Y/N) : ");
found=0;
} // end if
else
{
fwrite(&usrrec,sizeof(usrrec),1,temp1);
}//end else
}//end while
if(found==0)
{
confirm = getch();
if((confirm=='y')||(confirm=='Y'))
{
fcloseall(); //close all files
remove("userfile.dat");
rename("temp1.dat","userfile.dat");
gotoxy(10,9); printf("USER DELETED");
gotoxy(10,11); printf("PRESS ANY KEY TO CONTINUE");
usrptr=fopen("userfile.dat","rb+");
getch();
cleardevice();
}//end if
}//end if
else
{
gotoxy(10,7); printf("NO RECORD FOUND");
gotoxy(10,9); printf("PRESS ANY KEY TO CONTINUE");
fclose(temp1);
remove("temp1.dat");
getch();
cleardevice();
}//end else
rewind(usrptr);
}
int check_user(void)
{
int i=0,returnvar=1,checkname,checkpswd;
gotoxy(25,10); printf("ENTER USER NAME : ");
gets(name); strupr(name);
gotoxy(25,12); printf("ENTER PASSWORD : ");
//gets(pswd);
char ch=NULL;
char
pswd[12]={'\0','\0','\0','\0','\0','\0','\0','\0','\0','\0'
,'\0','\0'};
while(ch!='\r')
{
ch=getch();
if(ch!='\r')
{printf("*");
pswd[i]=ch;i++;
}//end if
}//end while
rewind(usrptr);
while(fread(&usrrec,sizeof(usrrec),1,usrptr)==1)
{
char *s1=name,*s2=pswd,*s3=usrrec.username,
*s4=usrrec.userpswd;
checkname=strcmp(s1,s3);
checkpswd=strcmp(s2,s4);
if((checkname==0) && (checkpswd==0))
{returnvar=0;}
}//end while
return(returnvar);
}//end body of check_user
void end_splash(void)
{
int driver=DETECT,mode;
//initialize graphics
initgraph(&driver,&mode,"c:\\tc\bgi");
setbkcolor(1);
setcolor(15);
getch();
closegraph();
}
int initmouse()
{
i.x.ax=0;
int86(0x33,&i,&o);
return(o.x.ax);
}
void showmouseptr()
{
i.x.ax=1;
int86(0x33,&i,&o);
}
int restrictmouseptr(int x1,int y1,int x2,int y2)
{
i.x.ax=7;
i.x.cx=x1;
i.x.dx=x2;
int86(0x33,&i,&o);
i.x.ax=8;
i.x.cx=y1;
i.x.dx=y2;
int86(0x33,&i,&o);
}
CONDITIONAL TESTING
In this part of the testing each of the conditions were tested to both
true and false aspects. All the resulting paths were tested so that each path on
particular condition is traced to uncover any possible errors.
LOOP TESTING
In this type of testing all the loops are tested to all the limits possible.
All the loops were tested specially at their boundaries, that is, lower and
upper limit. All the loops were skipped at least once. In nested loops the
inner most loops were tested first working outwards.
INTEGRATION TESTING
INTEGRATION APPROACH
We have used combined approach for integrating different part of
software. the Top-Down strategy have been used for upper level modules
and Bottom-Up strategy have been used for sub-ordinate levels
Example
Login and homepage module was integrated first in Top-Down
strategy manner. Then the new entry module was created, and this newly
created module after thorough testing was integrated to the system. As new
modules were created, they were added slowly and steadily to the system.
Each time a thoroughly tested module was added to the system, the
regression testing was performed to confirm that newly added module has
not created any unwanted changes
GUI TESTING
GUI testing is done to ensure uniform look and feel of the user
interface components across the application. All the major elements of the
graphical interface such as Window’s, mouse operations etc were validated
during GUI testing. For GUI testing, various selections or options were
made through mouse as well as keyboard to ensure that it works both ways.
It was tested that appropriate messages appear to guide the user through the
course of action.
VALIDATION TESTING
that protection mechanisms built into a system will, in fact, protect it from
improper penetration.
CONCLUSION
CONCLUSION
It has been a great pleasure for me to work on this exciting project.
This project proved good for me as it provided practical knowledge of not
only programming in C++ Windows Application, but also about all handling
procedure related with “School Automation System”. It also provides
knowledge about the latest technology used in developing windows enabled
application and client server technology that will be great demand in future.
This will provide better opportunities and guidance in future in developing
projects independently. The project has been appreciated by all the users in
the organization. It is easy to use and User friendly screens are provided. It
has been thoroughly tested and implemented.
The quality of any project is measured through the Merits and the
Limitations of the project, which it is offering to the user.