Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

CBSE Computer Project for Class 12 ( C++)

Computer project for class 12 students on elements in the periodic table using graphics.h.

Related Books

Free with a 30 day trial from Scribd

See all
  • Be the first to comment

CBSE Computer Project for Class 12 ( C++)

  1. 1. CONTENTS  HEADER FILES AND FUNCTIONS  WORKING DESCRIPTION  SOURCE CODE  OUTPUT
  2. 2. 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
  3. 3. 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()
  4. 4. 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<<"%";}
  5. 5. gotoxy(34,9);puts(name); gotoxy(33,10);cout<<"~~~~~~~~~~~~"; gotoxy(31,12);cout<<"Symbol:"<<sym; gotoxy(31,14);cout<<"At.Number:"<<atno; gotoxy(31,16);cout<<"Mass: "<<mass; gotoxy(31,18);cout<<"Group:"<<grp; gotoxy(40,18);cout<<"Period: "<<period; getch(); } void Sort(int a,int b,Element A[118]) { for(int i=a-a;i<=b-a;++i) { for(int j=a-a;j<b-a-i;++j) { if(strcmpi(A[a+j].name,A[a+j+1].name)>0) { char temp[30]; strcpy(temp,A[j+a].name); strcpy(A[j+a].name,A[j+1+a].name); strcpy(A[j+1+a].name,temp); } } } cout<<"nSelected Range of Elements Sorted Alphabetically:-n"; for(int k=a;k<=b;++k) { cout<<A[k].name<<endl; } getch(); } void intro() { clrscr(); int gr=0,gm=DETECT; initgraph(&gr,&gm,"C:TCBGI"); int x=getmaxx(); int y=getmaxy(); //main table line(1,1,1,280); line(30,1,30,280); line(60,40,60,280); line(90,120,90,280); line(120,120,120,280); line(150,120,150,280); line(180,120,180,280); line(210,120,210,280); line(240,120,240,280); line(270,120,270,280); line(300,120,300,280); line(330,120,330,280);
  6. 6. line(360,40,360,280); line(390,40,390,280); line(420,40,420,280); line(450,40,450,280); line(480,40,480,280); line(510,1,510,280); line(540,1,540,280); line(1,1,30,1);line(510,1,540,1);//top line(1,280,540,280);//bottom line(1,40,60,40);line(360,40,540,40);// 1 period line(1,80,60,80);line(360,80,540,80);//2 period line(1,120,540,120);line(360,120,540,120);//3 period line(1,160,540,160); line(1,200,540,200); line(1,240,540,240); rectangle(1,310,420,390);//lanthanoids line(1,350,420,350);//partition // f-block partitions line(30,310,30,390); line(60,310,60,390); line(90,310,90,390); line(120,310,120,390); line(150,310,150,390); line(180,310,180,390); line(210,310,210,390); line(240,310,240,390); line(270,310,270,390); line(300,310,300,390); line(330,310,330,390); line(360,310,360,390); line(390,310,390,390); setcolor(CYAN); //lanthanoids outtextxy(7,318,"Ce"); outtextxy(37,318,"Pr"); outtextxy(67,318,"Nd"); outtextxy(97,318,"Pm"); outtextxy(127,318,"Sm"); outtextxy(157,318,"Eu"); outtextxy(187,318,"Gd"); outtextxy(217,318,"Tb"); outtextxy(247,318,"Dy"); outtextxy(277,318,"Ho"); outtextxy(307,318,"Er"); outtextxy(337,318,"Tm"); outtextxy(367,318,"Yb"); outtextxy(397,318,"Lu"); //actinoids
  7. 7. setcolor(GREEN); outtextxy(7,358,"Th"); outtextxy(37,358,"Pa"); outtextxy(67,358,"U"); outtextxy(97,358,"Np"); outtextxy(127,358,"Pu"); outtextxy(157,358,"Am"); outtextxy(187,358,"Cm"); outtextxy(217,358,"Bk"); outtextxy(247,358,"Cf"); outtextxy(277,358,"Es"); outtextxy(307,358,"Fm"); outtextxy(337,358,"Md"); outtextxy(367,358,"No"); outtextxy(397,358,"Lr"); setcolor(12); outtextxy(7,8,"H"); outtextxy(7,48,"Li"); outtextxy(7,88,"Na"); outtextxy(7,128,"K"); outtextxy(7,168,"Rb"); outtextxy(7,208,"Cs"); outtextxy(7,248,"Fr"); outtextxy(37,48,"Be"); outtextxy(37,88,"Mg"); outtextxy(37,128,"Ca"); outtextxy(37,168,"Sr"); outtextxy(37,208,"Ba"); outtextxy(37,248,"Ra"); setcolor(MAGENTA); outtextxy(67,128,"Sc"); outtextxy(67,168,"Y"); outtextxy(67,208,"La"); outtextxy(67,248,"Ac"); setcolor(CYAN); outtextxy(67,220,"&"); setcolor(GREEN); outtextxy(67,260,"@"); setcolor(MAGENTA); outtextxy(97,128,"Ti"); outtextxy(97,168,"Zr"); outtextxy(97,208,"Hf"); outtextxy(97,248,"Rf"); outtextxy(127,128,"V"); outtextxy(127,168,"Nb"); outtextxy(127,208,"Ta"); outtextxy(127,248,"Db");
  8. 8. outtextxy(157,128,"Cr"); outtextxy(157,168,"Mo"); outtextxy(157,208,"W"); outtextxy(157,248,"Sg"); outtextxy(187,128,"Mn"); outtextxy(187,168,"Tc"); outtextxy(187,208,"Re"); outtextxy(187,248,"Bh"); outtextxy(217,128,"Fe"); outtextxy(217,168,"Ru"); outtextxy(217,208,"Os"); outtextxy(217,248,"Hs"); outtextxy(247,128,"Co"); outtextxy(247,168,"Rh"); outtextxy(247,208,"Ir"); outtextxy(247,248,"Mt"); outtextxy(277,128,"Ni"); outtextxy(277,168,"Pd"); outtextxy(277,208,"Pt"); outtextxy(277,248,"Ds"); outtextxy(307,128,"Cu"); outtextxy(307,168,"Ag"); outtextxy(307,208,"Au"); outtextxy(307,248,"Rg"); outtextxy(337,128,"Zn"); outtextxy(337,168,"Cd"); outtextxy(337,208,"Hg"); outtextxy(337,248,"Cn"); setcolor(YELLOW); outtextxy(367,48,"B"); outtextxy(367,88,"Al"); outtextxy(367,128,"Ga"); outtextxy(367,168,"In"); outtextxy(367,208,"Tl"); outtextxy(367,248,"Uut"); outtextxy(397,48,"C"); outtextxy(397,88,"Si"); outtextxy(397,128,"Ge"); outtextxy(397,168,"Sn"); outtextxy(397,208,"Pb"); outtextxy(397,246,"Uuq"); outtextxy(427,48,"N"); outtextxy(427,88,"P"); outtextxy(427,128,"As");
  9. 9. outtextxy(427,168,"Sb"); outtextxy(427,208,"Bi"); outtextxy(427,246,"Uup"); outtextxy(457,48,"O"); outtextxy(457,88,"S"); outtextxy(457,128,"Se"); outtextxy(457,168,"Te"); outtextxy(457,208,"Po"); outtextxy(457,246,"Uuh"); outtextxy(487,48,"F"); outtextxy(487,88,"Cl"); outtextxy(487,128,"Br"); outtextxy(487,168,"I"); outtextxy(487,208,"At"); outtextxy(487,245,"Uus"); outtextxy(517,8,"He"); outtextxy(517,48,"Ne"); outtextxy(517,88,"Ar"); outtextxy(517,128,"Kr"); outtextxy(517,168,"Xe"); outtextxy(517,208,"Rn"); outtextxy(517,245,"Uuo"); getch(); closegraph(); //end of intro page graphics } void definition(Element A[118]) { clrscr(); A[0].defatno(); A[0].grp=1; A[0].period=1; A[0].mass=1; strcpy(A[0].sym,"H"); strcpy(A[0].name,"Hydrogen"); A[1].defatno(); A[1].grp=18; A[1].period=1; A[1].mass=4; strcpy(A[1].sym,"He"); strcpy(A[1].name,"Helium"); A[2].defatno(); A[2].grp=1;
  10. 10. A[2].period=2; A[2].mass=6.9; strcpy(A[2].sym,"Li"); strcpy(A[2].name,"Lithium"); A[3].defatno(); A[3].grp=2; A[3].period=2; A[3].mass=9.1; strcpy(A[3].sym,"Be"); strcpy(A[3].name,"Beryllium"); A[4].defatno(); A[4].grp=13; A[4].period=2; A[4].mass=10.8; strcpy(A[4].sym,"B"); strcpy(A[4].name,"Boron"); A[5].defatno(); A[5].grp=14; A[5].period=2; A[5].mass=12; strcpy(A[5].sym,"C"); strcpy(A[5].name,"Carbon"); A[6].defatno(); A[6].grp=15; A[6].period=2; A[6].mass=14; strcpy(A[6].sym,"N"); strcpy(A[6].name,"Nitrogen"); A[7].defatno(); A[7].grp=16; A[7].period=2; A[7].mass=16; strcpy(A[7].sym,"O"); strcpy(A[7].name,"Oxygen"); A[8].defatno(); A[8].grp=17; A[8].period=2; A[8].mass=19; strcpy(A[8].sym,"F"); strcpy(A[8].name,"Fluorine"); A[9].defatno(); A[9].grp=18; A[9].period=2; A[9].mass=20.1; strcpy(A[9].sym,"Ne"); strcpy(A[9].name,"Neon");
  11. 11. A[10].defatno(); A[10].grp=1; A[10].period=3; A[10].mass=23; strcpy(A[10].sym,"Na"); strcpy(A[10].name,"Sodium"); A[11].defatno(); A[11].grp=2; A[11].period=3; A[11].mass=24.3; strcpy(A[11].sym,"Mg"); strcpy(A[11].name,"Magnesium"); A[12].defatno(); A[12].grp=13; A[12].period=3; A[12].mass=27; strcpy(A[12].sym,"Al"); strcpy(A[12].name,"Aluminium"); A[13].defatno(); A[13].grp=14; A[13].period=3; A[13].mass=28; strcpy(A[13].sym,"Si"); strcpy(A[13].name,"Silicon"); A[14].defatno(); A[14].grp=15; A[14].period=3; A[14].mass=31; strcpy(A[14].sym,"P"); strcpy(A[14].name,"Phosphorus"); A[15].defatno(); A[15].grp=16; A[15].period=3; A[15].mass=32; strcpy(A[15].sym,"S"); strcpy(A[15].name,"Sulphur"); A[16].defatno(); A[16].grp=17; A[16].period=3; A[16].mass=35.5; strcpy(A[16].sym,"Cl"); strcpy(A[16].name,"Chlorine"); A[17].defatno(); A[17].grp=18; A[17].period=3;
  12. 12. A[17].mass=39,9; strcpy(A[17].sym,"Ar"); strcpy(A[17].name,"Argon"); A[18].defatno(); A[18].grp=1; A[18].period=4; A[18].mass=39; strcpy(A[18].sym,"K"); strcpy(A[18].name,"Potassium"); A[19].defatno(); A[19].grp=2; A[19].period=4; A[19].mass=40; strcpy(A[19].sym,"Ca"); strcpy(A[19].name,"Calcium"); A[20].defatno(); A[20].grp=3; A[20].period=4; A[20].mass=45; strcpy(A[20].sym,"Sc"); strcpy(A[20].name,"Scandium"); A[21].defatno(); A[21].grp=4; A[21].period=4; A[21].mass=47.8; strcpy(A[21].sym,"Ti"); strcpy(A[21].name,"Titanium"); A[22].defatno(); A[22].grp=5; A[22].period=4; A[22].mass=51; strcpy(A[22].sym,"V"); strcpy(A[22].name,"Vanadium"); A[23].defatno(); A[23].grp=6; A[23].period=4; A[23].mass=52; strcpy(A[23].sym,"Cr"); strcpy(A[23].name,"Chromium"); A[24].defatno(); A[24].grp=7; A[24].period=4; A[24].mass=55; strcpy(A[24].sym,"Mn"); strcpy(A[24].name,"Manganese");
  13. 13. A[25].defatno(); A[25].grp=8; A[25].period=4; A[25].mass=56; strcpy(A[25].sym,"Fe"); strcpy(A[25].name,"Iron"); A[26].defatno(); A[26].grp=59; A[26].period=4; A[26].mass=59; strcpy(A[26].sym,"Co"); strcpy(A[26].name,"Cobalt"); A[27].defatno(); A[27].grp=10; A[27].period=4; A[27].mass=58.7; strcpy(A[27].sym,"Ni"); strcpy(A[27].name,"Nickel"); A[28].defatno(); A[28].grp=11; A[28].period=4; A[28].mass=63.5; strcpy(A[28].sym,"Cu"); strcpy(A[28].name,"Copper"); A[29].defatno(); A[29].grp=12; A[29].period=4; A[29].mass=65.4; strcpy(A[29].sym,"Zn"); strcpy(A[29].name,"Zinc"); A[30].defatno(); A[30].grp=13; A[30].period=4; A[30].mass=69.7; strcpy(A[30].sym,"Ga"); strcpy(A[30].name,"Gallium"); A[31].defatno(); A[31].grp=14; A[31].period=4; A[31].mass=72.6; strcpy(A[31].sym,"Ge"); strcpy(A[31].name,"Germanium"); A[32].defatno(); A[32].grp=15; A[32].period=4; A[32].mass=75;
  14. 14. strcpy(A[32].sym,"As"); strcpy(A[32].name,"Arsenic"); A[33].defatno(); A[33].grp=16; A[33].period=4; A[33].mass=79; strcpy(A[33].sym,"Se"); strcpy(A[33].name,"Selenium"); A[34].defatno(); A[34].grp=17; A[34].period=4; A[34].mass=80; strcpy(A[34].sym,"Br"); strcpy(A[34].name,"Bromine"); A[35].defatno(); A[35].grp=18; A[35].period=4; A[35].mass=83.8; strcpy(A[35].sym,"Kr"); strcpy(A[35].name,"Krypton"); A[36].defatno(); A[36].grp=1; A[36].period=5; A[36].mass=85.5; strcpy(A[36].sym,"Rb"); strcpy(A[36].name,"Rubidium"); A[37].defatno(); A[37].grp=2; A[37].period=5; A[37].mass=87.6; strcpy(A[37].sym,"Sr"); strcpy(A[37].name,"Strontium"); A[38].defatno(); A[38].grp=3; A[38].period=5; A[38].mass=89; strcpy(A[38].sym,"Y"); strcpy(A[38].name,"Ytterium"); A[39].defatno(); A[39].grp=4; A[39].period=5; A[39].mass=91.2; strcpy(A[39].sym,"Zr"); strcpy(A[39].name,"Zirconium"); A[40].defatno();
  15. 15. A[40].grp=5; A[40].period=5; A[40].mass=93; strcpy(A[40].sym,"Nb"); strcpy(A[40].name,"Niobium"); A[41].defatno(); A[41].grp=6; A[41].period=5; A[41].mass=96; strcpy(A[41].sym,"Mo"); strcpy(A[41].name,"Molybdenum"); A[42].defatno(); A[42].grp=7; A[42].period=5; A[42].mass=99; strcpy(A[42].sym,"Tc"); strcpy(A[42].name,"Technetium"); A[43].defatno(); A[43].grp=8; A[43].period=5; A[43].mass=101; strcpy(A[43].sym,"Ru"); strcpy(A[43].name,"Ruthenium"); A[44].defatno(); A[44].grp=9; A[44].period=5; A[44].mass=103; strcpy(A[44].sym,"Rh"); strcpy(A[44].name,"Rhodium"); A[45].defatno(); A[45].grp=10; A[45].period=5; A[45].mass=106.4; strcpy(A[45].sym,"Pd"); strcpy(A[45].name,"Palladium"); A[46].defatno(); A[46].grp=11; A[46].period=5; A[46].mass=108; strcpy(A[46].sym,"Ag"); strcpy(A[46].name,"Silver"); A[47].defatno(); A[47].grp=12; A[47].period=5; A[47].mass=112.4; strcpy(A[47].sym,"Cd");
  16. 16. strcpy(A[47].name,"Cadmium"); A[48].defatno(); A[48].grp=13; A[48].period=5; A[48].mass=114.8; strcpy(A[48].sym,"In"); strcpy(A[48].name,"Indium"); A[49].defatno(); A[49].grp=14; A[49].period=5; A[49].mass=118.7; strcpy(A[49].sym,"Sn"); strcpy(A[49].name,"Tin"); A[50].defatno(); A[50].grp=15; A[50].period=5; A[50].mass=121.7; strcpy(A[50].sym,"Sb"); strcpy(A[50].name,"Antimony"); A[51].defatno(); A[51].grp=16; A[51].period=5; A[51].mass=127.6; strcpy(A[51].sym,"Te"); strcpy(A[51].name,"Tellurium"); A[52].defatno(); A[52].grp=17; A[52].period=5; A[52].mass=126.9; strcpy(A[52].sym,"I"); strcpy(A[52].name,"Iodine"); A[53].defatno(); A[53].grp=18; A[53].period=5; A[53].mass=131.2; strcpy(A[53].sym,"Xe"); strcpy(A[53].name,"Xenon"); A[54].defatno(); A[54].grp=1; A[54].period=6; A[54].mass=133; strcpy(A[54].sym,"Cs"); strcpy(A[54].name,"Cesium"); A[55].defatno();
  17. 17. A[55].grp=2; A[55].period=6; A[55].mass=137.3; strcpy(A[55].sym,"Ba"); strcpy(A[55].name,"Barium"); A[56].defatno(); A[56].grp=3; A[56].period=6; A[56].mass=139; strcpy(A[56].sym,"La"); strcpy(A[56].name,"Lanthanum"); A[57].defatno(); A[57].period=6; A[57].mass=140; strcpy(A[57].sym,"Ce"); strcpy(A[57].name,"Cerium"); A[58].defatno(); A[58].period=6; A[58].mass=141; strcpy(A[58].sym,"Pr"); strcpy(A[58].name,"Praseodymium"); A[59].defatno(); A[59].period=6; A[59].mass=144; strcpy(A[59].sym,"Nd"); strcpy(A[59].name,"Neodymium"); A[60].defatno(); A[60].period=6; A[60].mass=147; strcpy(A[60].sym,"Pm"); strcpy(A[60].name,"Promethium"); A[61].defatno(); A[61].period=6; A[61].mass=150.3; strcpy(A[61].sym,"Sm"); strcpy(A[61].name,"Samarium"); A[62].defatno(); A[62].period=6; A[62].mass=151; strcpy(A[62].sym,"Eu"); strcpy(A[62].name,"Europium"); A[63].defatno(); A[63].period=6; A[63].mass=157; strcpy(A[63].sym,"Gd");
  18. 18. strcpy(A[63].name,"Gadolinium"); A[64].defatno(); A[64].period=6; A[64].mass=159; strcpy(A[64].sym,"Tb"); strcpy(A[64].name,"Terbium"); A[65].defatno(); A[65].period=6; A[65].mass=162.5; strcpy(A[65].sym,"Dy"); strcpy(A[65].name,"Dysprosium"); A[66].defatno(); A[66].period=6; A[66].mass=165; strcpy(A[66].sym,"Ho"); strcpy(A[66].name,"Holmium"); A[67].defatno(); A[67].period=6; A[67].mass=167; strcpy(A[67].sym,"Erbium"); strcpy(A[67].name,"Erbium"); A[68].defatno(); A[68].period=6; A[68].mass=168.9; strcpy(A[68].sym,"Tm"); strcpy(A[68].name,"Thullium"); A[69].defatno(); A[69].period=6; A[69].mass=173; strcpy(A[69].sym,"Yb"); strcpy(A[69].name,"Ytterbium"); A[70].defatno(); A[70].period=6; A[70].mass=175; strcpy(A[70].sym,"Lu"); strcpy(A[70].name,"Lutetium"); A[71].defatno(); A[71].grp=4; A[71].period=6; A[71].mass=178.5; strcpy(A[71].sym,"Hf"); strcpy(A[71].name,"Hafnium"); A[72].defatno(); A[72].grp=5;
  19. 19. A[72].period=6; A[72].mass=181; strcpy(A[72].sym,"Ta"); strcpy(A[72].name,"Tantalum"); A[73].defatno(); A[73].grp=6; A[73].period=6; A[73].mass=183.8; strcpy(A[73].sym,"W"); strcpy(A[73].name,"Tungsten"); A[74].defatno(); A[74].grp=7; A[74].period=6; A[74].mass=186.2; strcpy(A[74].sym,"Re"); strcpy(A[74].name,"Rhenium"); A[75].defatno(); A[75].grp=8; A[75].period=6; A[75].mass=190; strcpy(A[75].sym,"Os"); strcpy(A[75].name,"Osmium"); A[76].defatno(); A[76].grp=9; A[76].period=6; A[76].mass=192; strcpy(A[76].sym,"Ir"); strcpy(A[76].name,"Iridium"); A[77].defatno(); A[77].grp=10; A[77].period=6; A[77].mass=195; strcpy(A[77].sym,"Pt"); strcpy(A[77].name,"Platinum"); A[78].defatno(); A[78].grp=11; A[78].period=6; A[78].mass=197; strcpy(A[78].sym,"Au"); strcpy(A[78].name,"Gold"); A[79].defatno(); A[79].grp=12; A[79].period=6; A[79].mass=200.5; strcpy(A[79].sym,"Hg"); strcpy(A[79].name,"Mercury");
  20. 20. A[80].defatno(); A[80].grp=13; A[80].period=6; A[80].mass=204.3; strcpy(A[80].sym,"Tl"); strcpy(A[80].name,"Thallium"); A[81].defatno(); A[81].grp=14; A[81].period=6; A[81].mass=207; strcpy(A[81].sym,"Pb"); strcpy(A[81].name,"Lead"); A[82].defatno(); A[82].grp=15; A[82].period=6; A[82].mass=209; strcpy(A[82].sym,"Bi"); strcpy(A[82].name,"Bismuth"); A[83].defatno(); A[83].grp=16; A[83].period=6; A[83].mass=209.9; strcpy(A[83].sym,"Po"); strcpy(A[83].name,"Polonium"); A[84].defatno(); A[84].grp=17; A[84].period=6; A[84].mass=210; strcpy(A[84].sym,"At"); strcpy(A[84].name,"Astatine"); A[85].defatno(); A[85].grp=18; A[85].period=6; A[85].mass=222; strcpy(A[85].sym,"Rn"); strcpy(A[85].name,"Radon"); A[86].defatno(); A[86].grp=1; A[86].period=7; A[86].mass=223; strcpy(A[86].sym,"Fr"); strcpy(A[86].name,"Francium"); A[87].defatno(); A[87].grp=2; A[87].period=7;
  21. 21. A[87].mass=226; strcpy(A[87].sym,"Ra"); strcpy(A[87].name,"Radium"); A[88].defatno(); A[88].grp=3; A[88].period=7; A[88].mass=227; strcpy(A[88].sym,"Ac"); strcpy(A[88].name,"Actinium"); A[89].defatno(); A[89].period=7; A[89].mass=232; strcpy(A[89].sym,"Th"); strcpy(A[89].name,"Thorium"); A[90].defatno(); A[90].grp=0; A[90].period=7; A[90].mass=231; strcpy(A[90].sym,"Pa"); strcpy(A[90].name,"Protactinium"); A[91].defatno(); A[91].grp=0; A[91].period=7; A[91].mass=238; strcpy(A[91].sym,"U"); strcpy(A[91].name,"Uranium"); A[92].defatno(); A[92].grp=0; A[92].period=7; A[92].mass=237; strcpy(A[92].sym,"Np"); strcpy(A[92].name,"Neptunium"); A[93].defatno(); A[93].grp=0; A[93].period=7; A[93].mass=244; strcpy(A[93].sym,"Pu"); strcpy(A[93].name,"Plutonium"); A[94].defatno(); A[94].grp=0; A[94].period=7; A[94].mass=243; strcpy(A[94].sym,"Am"); strcpy(A[94].name,"Americium"); A[95].defatno();
  22. 22. A[95].grp=0; A[95].period=7; A[95].mass=247; strcpy(A[95].sym,"Cm"); strcpy(A[95].name,"Curium"); A[96].defatno(); A[96].grp=0; A[96].period=7; A[96].mass=247; strcpy(A[96].sym,"Bk"); strcpy(A[96].name,"Berkelium"); A[97].defatno(); A[97].period=7; A[97].mass=251; strcpy(A[97].sym,"Cf"); strcpy(A[97].name,"Californium"); A[98].defatno(); A[98].period=7; A[98].mass=252; strcpy(A[98].sym,"Es"); strcpy(A[98].name,"Einsteinium"); A[99].defatno(); A[99].period=7; A[99].mass=257; strcpy(A[99].sym,"Fm"); strcpy(A[99].name,"Fermium"); A[100].defatno(); A[100].period=7; A[100].mass=258; strcpy(A[100].sym,"Md"); strcpy(A[100].name,"Mendelivium"); A[101].defatno(); A[101].period=7; A[101].mass=259; strcpy(A[101].sym,"No"); strcpy(A[101].name,"Nobelium"); A[102].defatno(); A[102].period=7; A[102].mass=262; strcpy(A[102].sym,"Lr"); strcpy(A[102].name,"Lawrencium"); A[103].defatno(); A[103].grp=4; A[103].period=7; A[103].mass=261;
  23. 23. strcpy(A[103].sym,"Rf"); strcpy(A[103].name,"Rutherfordium"); A[104].defatno(); A[104].grp=5; A[104].period=7; A[104].mass=261.1; strcpy(A[104].sym,"Db"); strcpy(A[104].name,"Dubnium"); A[105].defatno(); A[105].grp=6; A[105].period=7; A[105].mass=263; strcpy(A[105].sym,"Sg"); strcpy(A[105].name,"Seaborgium"); A[106].defatno(); A[106].grp=7; A[106].period=7; A[106].mass=262.1; strcpy(A[106].sym,"Bh"); strcpy(A[106].name,"Bohrium"); A[107].defatno(); A[107].grp=8; A[107].period=7; A[107].mass=277; strcpy(A[107].sym,"Hs"); strcpy(A[107].name,"Hassium"); A[108].defatno(); A[108].grp=9; A[108].period=7; A[108].mass=268; strcpy(A[108].sym,"Mt"); strcpy(A[108].name,"Meitnerium"); A[109].defatno(); A[109].grp=10; A[109].period=7; A[109].mass=269; strcpy(A[109].sym,"Ds"); strcpy(A[109].name,"Darmstadtium"); A[110].defatno(); A[110].grp=11; A[110].period=7; A[110].mass=272; strcpy(A[110].sym,"Rg"); strcpy(A[110].name,"Roentgenium"); A[111].defatno();
  24. 24. A[111].grp=12; A[111].period=7; A[111].mass=277; strcpy(A[111].sym,"Cn"); strcpy(A[111].name,"Copernicium"); A[112].defatno(); A[112].grp=13; A[112].period=7; A[112].mass=284; strcpy(A[112].sym,"Uut"); strcpy(A[112].name,"Ununtrium"); A[113].defatno(); A[113].grp=14; A[113].period=7; A[113].mass=289; strcpy(A[113].sym,"Uuq"); strcpy(A[113].name,"Ununquadium"); A[114].defatno(); A[114].grp=15; A[114].period=7; A[114].mass=288; strcpy(A[114].sym,"Uup"); strcpy(A[114].name,"Ununpentium"); A[115].defatno(); A[115].grp=16; A[115].period=7; A[115].mass=292; strcpy(A[115].sym,"Uuh"); strcpy(A[115].name,"Ununhexium"); A[116].defatno(); A[116].grp=17; A[116].period=7; A[116].mass=294; strcpy(A[116].sym,"Uus"); strcpy(A[116].name,"Ununseptium"); A[117].defatno(); A[117].grp=18; A[117].period=7; A[117].mass=296; strcpy(A[117].sym,"Uuo"); strcpy(A[117].name,"Ununoctium"); getch(); } void main() {
  25. 25. clrscr(); Element A[118]; definition(A); //to define all elements and their properties int ch=0; while(ch<5){ clrscr(); gotoxy(35,5);cout<<"WELCOME!!"; gotoxy(35,7);cout<<"MAIN MENU"; gotoxy(35,8);cout<<"*********"; for(int j=13;j<65;++j) {gotoxy(j,4);cout<<"= ";} for(int i=5;i<25;++i) {gotoxy(13,i);cout<<"||";} for(i=5;i<24;++i) {gotoxy(63,i);cout<<"||";} for(i=13;i<65;++i) {gotoxy(i,24);cout<<"=";} gotoxy(25,10);cout<<"1.Search element by Name/Symbol"; gotoxy(25,12);cout<<"2.Search element by Atomic Number"; gotoxy(25,14);cout<<"3.Display Modern Periodic Table"; gotoxy(25,16);cout<<"4.Sort Alphabetically"; gotoxy(25,18);cout<<"5.EXIT"; gotoxy(25,22);cout<<"Enter your choice(1-5):"; cin>>ch; switch(ch) { case 1: clrscr(); char sname[24]; cout<<"Enter element name/symbol: "; gets(sname); for(i=0;i<118;++i) { if(strcmpi(sname,A[i].name)==0||strcmpi(sname,A[i].sym)==0) { clrscr(); A[i].Display(); } } getch(); break; case 2: clrscr(); int sno; cout<<"Enter atomic number: "; cin>>sno; for(i=0;i<118;++i) { if(A[i].getatno()==sno) { clrscr();
  26. 26. A[i].Display(); } } getch(); break; case 3: clrscr(); intro(); break; case 4: clrscr(); int min,max; do{ cout<<"Enter range of atomic numbers:"; cin>>min>>max; }while(min<1||max>118); Sort(min-1,max-1,A); break; default:cout<<"INVALID CHOICE"; } //switch }//while if(ch==5) exit(7); getch(); }
  27. 27. OUTPUT

    Be the first to comment

    Login to see the comments

  • samdominic1

    Oct. 19, 2017
  • HarshitBisht2

    Nov. 20, 2017
  • mgrwl2

    Dec. 12, 2017
  • ShibaniDas2

    Dec. 19, 2017
  • madhurkant

    Dec. 20, 2017
  • Hemanttuteja

    Jan. 10, 2018
  • AmanKothari12

    Jan. 14, 2018
  • HarshShah492

    Nov. 23, 2018
  • shivanikumari47

    Dec. 20, 2018
  • JatinKshatriya1

    Jan. 9, 2019
  • DhiineshS

    Jan. 17, 2019
  • MrRex2

    Jan. 24, 2019
  • nitinagarwal73113528

    Oct. 11, 2019
  • AnkitGupta1327

    Nov. 23, 2019
  • ManikandanathanKasini

    Dec. 13, 2019
  • SakshamSaxena30

    Jan. 11, 2020
  • anujkumar1152

    Jan. 14, 2020
  • pratyushagrawal10

    Jan. 16, 2020
  • ShubamRaina1

    Mar. 5, 2020
  • EverlastingAmse

    Dec. 9, 2020

Computer project for class 12 students on elements in the periodic table using graphics.h.

Views

Total views

13,587

On Slideshare

0

From embeds

0

Number of embeds

11

Actions

Downloads

401

Shares

0

Comments

0

Likes

29

×