Question: c++: I need help in sorting this text file alphabetically by the full name of the element (which includes the periodic table of elements) The

c++: I need help in sorting this text file alphabetically by the full name of the element (which includes the periodic table of elements)

The file name is periodictable.dat

this is the content of the file:

1 H 1.00794 Hydrogen

2 He 4.002602 Helium

3 Li 6.941 Lithium

4 Be 9.012182 Beryllium

5 B 10.811 Boron

6 C 12.0107 Carbon

7 N 14.0067 Nitrogen

8 O 15.9994 Oxygen

9 F 18.9984032 Fluorine

10 Ne 20.1797 Neon

11 Na 22.98976928 Sodium

12 Mg 24.305 Magnesium

13 Al 26.9815386 Aluminum

14 Si 28.0855 Silicon

15 P 30.973762 Phosphorus

16 S 32.065 Sulfur

17 Cl 35.453 Chlorine

18 Ar 39.948 Argon

19 K 39.0983 Potassium

20 Ca 40.078 Calcium

21 Sc 44.955912 Scandium

22 Ti 47.867 Titanium

23 V 50.9415 Vanadium

24 Cr 51.9961 Chromium

25 Mn 54.938045 Manganese

26 Fe 55.845 Iron

27 Co 58.933195 Cobalt

28 Ni 58.6934 Nickel

29 Cu 63.546 Copper

30 Zn 65.38 Zinc

31 Ga 69.723 Gallium

32 Ge 72.64 Germanium

33 As 74.9216 Arsenic

34 Se 78.96 Selenium

35 Br 79.904 Bromine

36 Kr 83.798 Krypton

37 Rb 85.4678 Rubidium

38 Sr 87.62 Strontium

39 Y 88.90585 Yttrium

40 Zr 91.224 Zirconium

41 Nb 92.90638 Niobium

42 Mo 95.96 Molybdenum

43 Tc 98 Technetium

44 Ru 101.07 Ruthenium

45 Rh 102.9055 Rhodium

46 Pd 106.42 Palladium

47 Ag 107.8682 Silver

48 Cd 112.411 Cadmium

49 In 114.818 Indium

50 Sn 118.71 Tin

51 Sb 121.76 Antimony

52 Te 127.6 Tellurium

53 I 126.90447 Iodine

54 Xe 131.293 Xenon

55 Cs 132.9054519 Cesium

56 Ba 137.327 Barium

57 La 138.90547 Lanthanum

58 Ce 140.116 Cerium

59 Pr 140.90765 Praseodymium

60 Nd 144.242 Neodymium

61 Pm 145 Promethium

62 Sm 150.36 Samarium

63 Eu 151.964 Europium

64 Gd 157.25 Gadolinium

65 Tb 158.92535 Terbium

66 Dy 162.5 Dysprosium

67 Ho 164.93032 Holmium

68 Er 167.259 Erbium

69 Tm 168.93421 Thulium

70 Yb 173.054 Ytterbium

71 Lu 174.9668 Lutetium

72 Hf 178.49 Hafnium

73 Ta 180.94788 Tantalum

74 W 183.84 Tungsten

75 Re 186.207 Rhenium

76 Os 190.23 Osmium

77 Ir 192.217 Iridium

78 Pt 195.084 Platinum

79 Au 196.966569 Gold

80 Hg 200.59 Mercury

81 Tl 204.3833 Thallium

82 Pb 207.2 Lead

83 Bi 208.9804 Bismuth

84 Po 209 Polonium

85 At 210 Astatine

86 Rn 222 Radon

87 Fr 223 Francium

88 Ra 226 Radium

89 Ac 227 Actinium

90 Th 232.03806 Thorium

91 Pa 231.03588 Protactinium

92 U 238.02891 Uranium

93 Np 237 Neptunium

94 Pu 244 Plutonium

95 Am 243 Americium

96 Cm 247 Curium

97 Bk 247 Berkelium

98 Cf 251 Californium

99 Es 252 Einsteinium

100 Fm 257 Fermium

101 Md 258 Mendelevium

102 No 259 Nobelium

103 Lr 262 Lawrencium

104 Rf 267 Rutherfordium

105 Db 268 Dubnium

106 Sg 271 Seaborgium

107 Bh 272 Bohrium

108 Hs 270 Hassium

109 Mt 276 Meitnerium

110 Ds 281 Darmstadtium

111 Rg 280 Roentgenium

112 Cn 285 Copernicium

113 Uut 284 Ununtrium

114 Uuq 289 Ununquadium

115 Uup 288 Ununpentium

116 Uuh 293 Ununhexium

117 Uus 294 Ununseptium

118 Uuo 294 Ununoctium

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!