This program displays information about all the elements in the modern periodic table through 5 options: 1) Search by name or symbol, 2) Search by atomic number, 3) Display table, 4) Alphabetical sort, 5) Exit. It defines 118 element objects with properties like name, symbol, number, mass, group, and period. The source code includes function definitions for initializing element data, displaying elements, and sorting alphabetically.
3. WORKING DESCRIPTION
This program is based on the Modern Periodic Table of Elements. It showcases all the
elements and their basic properties including name, symbol, atomic number, atomic mass,
group and period. This program contains 5 options:
1) Search element by name or symbol
2) Search element by atomic number
3) Display Modern Periodic Table
4) Sort elements alphabetically (Using Bubble Sort Technique)
5) Exit
4. HEADER FILES AND FUNCTIONS
HEADER FILES:
1) iostream.h – For cin, cout
2) conio.h – For console input output functions
3) stdio.h – For standard input output functions
4) stdlib.h – For exit function
5) graphics.h – For graphic related functions
6) string.h – For string manipulation function
INBUILT FUNCTIONS:
1) gotoxy()
2) strcmpi()
3) strcpy()
4) clrscr()
5) getch()
6) gets()
7) exit()
8) initgraph()
9) line()
10) outtextxy()
11) rectangle()
12) setcolor()
13) getmaxx()
14) getmaxy()
15) closegraph()
5. SOURCE CODE
/* Developed By: KARAN SINGH BORA
Class : 12-B
*/
#include<iostream.h>
#include<string.h>
#include<stdio.h>
#include<stdlib.h>
#include<graphics.h>
#include<conio.h>
class Element
{
int atno;
public:
int grp,period;
float mass;
char name[25];
char sym[4];
Element()
{
atno=period=1;
grp=0;
mass=0;
strcpy(name,"Hydrogen");
strcpy(sym,"H");
}
void defatno();
int getatno(){ return atno;};
void Display();
};
void Element::defatno()
{
static int x=1;
atno=x;
++x;
}
void Element::Display()
{
for(int k=20;k<55;++k)
{ gotoxy(k,8);cout<<"^";}
for(k=8;k<20;++k)
{ gotoxy(20,k);cout<<"%";}
for(k=20;k<55;++k)
{ gotoxy(k,20);cout<<"^";}
for(k=8;k<20;++k)
{ gotoxy(55,k);cout<<"%";}