Batch8 - Modern Periodic Table
Batch8 - Modern Periodic Table
K L UNIVERSITY
FRESHMAN ENGINEERING DEPARTMENT
A Project Based Lab Report
On
SUBMITTED BY:
Assistant Professor
KL UNIVERSITY
Green fields, Vaddeswaram – 522 502
Guntur Dt., AP, India.
DEPARTMENT OF BASIC ENGINEERING SCIENCES
CERTIFICATE
I express the sincere gratitude to our Director Dr. A. Jagdeesh for his
administration towards our academic growth.
1 Introduction 1
5 Implementation 6-14
8 Conclusion 17
INTRODUCTION
This project will help you to understand file handling in C i.e. creating a file and accessing
the stored data in the file, modifying and removing the stored data. It will also help you to
understand the use of functions as well as different parameters of C programming language.
The main functions used in designing the Modern Periodic Table project are:
• void add(): This function is used to input or add the information of new element
to the program.
• void explor(): This function is used to explore the stored information in the file
created.
• void main screen(): It is included in source code of project file in order to print
the text style and to control its color. This function is used to print the main
screen or menu of the project.
The key features of Modern Periodic Table mini project in C are briefly described below:
• Storage of Element Information: In the project, you can add any new element
with its name, symbol, atomic number, atomic weight and its some important
properties. When new element information is to be added to this Modern
Periodic Table, you have to enter 1 in the main menu and input information in
given format. This information is stored in file created on the hard disk of
computer by program itself.
• By name of element
• By symbol of element
• By atomic number of element
• By atomic weight of element
1|Page
AIM
Advantages:-
Disadvantages:-
Future enhancements:-
• With this program we can easily search any element and know
about its properties. We don’t need to reach any book for that
• We can also add new elements into the table very easily in
future
2|Page
SYSTEM REQUIREMENTS
➢ SOFTWARE REQUIREMENTS:
The major software requirements of the project are as follows:
Language : Turbo-C
Operating system: Windows Xp or later.
➢ HARDWARE REQUIREMENTS:
The hardware requirements that map towards the software are as follows:
3|Page
DATA FLOW DIAGRAM
4|Page
Algorithm
Step1: Start.
Step 4: Enter information of elements, name, symbol, atomic number, atomic weight.
Step 6: Enter the corresponding numbers, search by name, Search by symbol, search by atomic
number, search by atomic, Weight, return by main menu.
Step 10: Selected symbol, if step 10 is correct it goes to step 11 otherwise step12.
Step 12: Selected atomic number, if step 12 is correct it goes to step 13 otherwise step 14.
Step 14: Selected atomic weight, if step 14 is correct it goes to step 15 otherwise step 16.
5|Page
Step 21: Stop.
IMPLEMENTATION
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
struct element{
char name[20];
char sb[5];
int atm;
float atms;
char block;
char atc[20];
}p,q;
int rw,cl;
FILE*fp;
void add();
void explor();
void print();
void mainscreen();
void main()
{
int a,i,n,y;
char c,d;
char date1[15],date2[15],string1[20];
unsigned int tsz;
clrscr();
mainscreen();
label1:
textcolor(15);
gotoxy(22,15);textcolor(14);
cprintf("Enter the corresponding no");gotoxy(22,19);textcolor(10);
cprintf("1.Add new Element Information");gotoxy(22,21);
cprintf("2.Explore");gotoxy(22,23);
cprintf("3.Quit");gotoxy(22,25);
fflush(stdin);
d=getch();
switch(d)
{
case '1':
{
add();
break;
6|Page
}
case '2':
{
explor();
break;
}
case '3':
{
clrscr();
mainscreen();
textcolor(14); gotoxy(30,24);
cprintf("THANK U");gotoxy(30,26);
cprintf("BYE...........");
getch();
exit(1);
break;
}
default:
{
clrscr();
mainscreen();
textcolor(12+128);gotoxy(22,11);
cprintf("Wrong choice");gotoxy(22,13);textcolor(15);
cprintf("Retype choice");
goto label1;
}
}
clrscr();
mainscreen();
goto label1;
}
void mainscreen()
{
int i,j;
clrscr();
for(i=2,j=2;i<rw;j++)
{
if(j>15)
j=2;
textcolor(j);
gotoxy(i,2);
cprintf("%c",'*');
gotoxy(i,cl-1);
cprintf("%c",'*');
i++;
7|Page
}
for(i=2,j=2;i<cl;i++,j++)
{
if(j>15)
j=2;
textcolor(j);
gotoxy(2,i);
cprintf("%c",'*');
gotoxy(rw-1,i);
cprintf("%c",'*');
}
gotoxy(30,4);textcolor(3);
cprintf("Modern Periodic Table");
gotoxy(37,6);textcolor(6);
cprintf("Digital");
gotoxy(35,7); textcolor(15);
cprintf("-----------");
}
void add()
{
char ch;
label1:
clrscr();
mainscreen();
gotoxy(15,14);textcolor(10);
cprintf("Enter the Information of Elements:");
gotoxy(15,16);
cprintf("Name:");
gotoxy(15,18);
cprintf("Symbol:");
gotoxy(15,20);
cprintf("Atomic No: ");
gotoxy(15,22);
cprintf("Atomic Wt: ");
textcolor(15);
fflush(stdin);
gotoxy(20,16);
scanf("%[^\n]",p.name);
p.name[0]=toupper(p.name[0]);
fflush(stdin);
gotoxy(23,18);
scanf("%[^\n]",p.sb);
p.sb[0]=toupper(p.sb[0]);
8|Page
fflush(stdin);
gotoxy(25,20);
scanf("%d",&p.atm);
fflush(stdin);
gotoxy(25,22);
scanf("%f",&p.atms);
fflush(stdin);
gotoxy(29,24);
scanf("%[^\n]",p.atc);
if((fp=fopen("data","ab+"))==NULL)
{
printf("Cannot open the file f1");
getch();
exit(1);
}
fwrite(&p,sizeof(p),1,fp);
fclose(fp);
printf("\n\n\n\t\tEnter 'y' for next record(y/n):");
ch=getch();
if(ch=='y')
{
goto label1;
}
}
void explor()
{
char d,c;
FILE *f;
int given_atmic_no,a,i,tsz,n;
float given_atmic_mass;
int flag;
char string[20];
startofexplore:
clrscr();
mainscreen();
label6:
gotoxy(14,14);textcolor(12);
cprintf(" Enter the corresponding no ");gotoxy(17,15);textcolor(3);
cprintf(" 1.Search by 'NAME'");gotoxy(17,17);
cprintf("2.Search by SYMBOL");gotoxy(17,19);
cprintf("3.Search by ATOMIC NUMBER");gotoxy(17,21);
cprintf("4.Search by ATOMIC WEIGHT");gotoxy(17,23);
cprintf("5.Return to main menu");gotoxy(17,25);
fflush(stdin);
9|Page
d=getch();
switch(d)
{
case '1':
{
clrscr();
mainscreen();
gotoxy(15,25);
textcolor(12);
cprintf("Enter the Name of Element:");
textcolor(3);
fflush(stdin);
scanf("%[^\n]",string);
printf("%s",string);
string[0]=toupper(string[0]);
if((fp=fopen("data","rb+"))==NULL)
{
clrscr();
}
if(flag==1)
{
clrscr();
mainscreen();
gotoxy(25,25);
textcolor(12);
cprintf("::No Element Available::");
fclose(fp);
getch();
break;
}
case '2':
{
10 | P a g e
clrscr();
mainscreen();
gotoxy(22,15);
textcolor(12);
cprintf("Enter the symbol:");
textcolor(3);
fflush(stdin);
scanf("%[^\n]",string);
printf("%s",string);
string[0]=toupper(string[0]);
if((fp=fopen("data","rb+"))==NULL)
{
clrscr();
}
if(flag==1)
{
clrscr();
mainscreen();
gotoxy(25,25);
textcolor(12);
cprintf("::No Element Available::");
fclose(fp);
getch();
break;
}
case '5':
{
return;
}
case '3':
{
clrscr();
11 | P a g e
mainscreen();
gotoxy(15,25);
textcolor(12);
cprintf("Enter the Atomic No. Element:");
textcolor(3);
fflush(stdin);
scanf("%d",&given_atmic_no);
if((fp=fopen("data","rb+"))==NULL)
{
clrscr();
break;
}
}
if(flag==1)
{
clrscr();
mainscreen();
gotoxy(25,25);
textcolor(12);
cprintf("::No Element Available::");
fclose(fp);
getch();
break;
}
case '4':
{
clrscr();
mainscreen();
gotoxy(15,22);
textcolor(12);
cprintf("Enter the Atomic mass of Element:");
textcolor(3);
fflush(stdin);
12 | P a g e
scanf("%f",&given_atmic_mass);
if((fp=fopen("data","rb+"))==NULL)
{
clrscr();
break;
}
}
if(flag==1)
{
clrscr();
mainscreen();
gotoxy(25,25);
textcolor(12);
cprintf("::No Element Available::");
fclose(fp);
getch();
break;
}
default:
{
clrscr();
mainscreen();
textcolor(12+128);gotoxy(22,11);
cprintf("Wrong choice");gotoxy(22,13);textcolor(15);
cprintf("Retype choice");
goto label6;
}
}
goto startofexplore;
}
void print()
{
13 | P a g e
clrscr();
mainscreen();
gotoxy(15,16);
cprintf("Name:");
gotoxy(15,18);
cprintf("Symbol:");
gotoxy(15,20);
cprintf("Atomic No: ");
gotoxy(15,22);
cprintf("Atomic Wt: ");
gotoxy(15,24);
cprintf("Atomic Config:");
fflush(stdin);
gotoxy(15,26);
cprintf("Block:");
gotoxy(15,28);
cprintf("Properties:");
textcolor(6);
gotoxy(20,16);
cprintf("%s",p.name);
gotoxy(23,18);
cprintf("%s",p.sb);
fflush(stdin);
gotoxy(25,20);
cprintf("%d",p.atm);
fflush(stdin);
gotoxy(25,22);
cprintf("%f",p.atms);
fflush(stdin);
gotoxy(29,24);
cprintf("%s",p.atc);
gotoxy(21,26);
cprintf("%c",p.block);
14 | P a g e
INTEGRATION AND SYSTEM TESTING
OUTPUTS
Screen Shots:
15 | P a g e
16 | P a g e
CONCLUSION
17 | P a g e