BrU32

Untitled

Jun 1st, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 45.85 KB | None | 0 0
  1. #include "LinkedList.h"
  2. #include "Media.h"
  3. #include "CompactDisc.h"
  4. #include "DigitalDisk.h"
  5. #include <iostream>
  6. #include <iomanip>
  7. #include <string>
  8. using namespace std;
  9.  
  10. void addCD(LinkedList<CompactDisc> &);
  11. void addDVD(LinkedList<DigitalDisk> &);
  12. void subCD(LinkedList<CompactDisc> &);
  13. void subDVD(LinkedList<DigitalDisk> &);
  14. void modCD(LinkedList<CompactDisc> &);
  15. void modDVD(LinkedList<DigitalDisk> &);
  16. void quitManager(LinkedList<CompactDisc> &, LinkedList<DigitalDisk> &);
  17.  
  18. int main()
  19. {
  20. LinkedList<CompactDisc> cdCollection;
  21. LinkedList<DigitalDisk> dvdCollection;
  22. int choice = 1;
  23. cout << "Welcome to media manager. What would you like to do? ";
  24. cout << "\n1. Add a CD\n2. Add a DVD\n3. Remove a CD\n4. Remove a
  25. DVD\n5. Change a CD\n6. Change a DVD\n7.Quit and display
  26. collection\n";
  27. cin >> choice;
  28. while (choice != 7)
  29. {
  30. if (choice == 1)
  31. {
  32. addCD(cdCollection);
  33. }
  34. else if (choice == 2)
  35. {
  36. addDVD(dvdCollection);
  37. }
  38. else if (choice == 3)
  39. {
  40. subCD(cdCollection);
  41. }
  42. else if (choice == 4)
  43. {
  44. subDVD(dvdCollection);
  45. }
  46. else if (choice == 5)
  47. {
  48. modCD(cdCollection);
  49. }
  50. else if (choice == 6)
  51. {
  52. modDVD(dvdCollection);
  53. }
  54. else
  55. {
  56. cout << "\nEnter a valid choice";
  57. }
  58. cout << "\n1. Add a CD\n2. Add a DVD\n3. Remove a CD\n4. Remove a
  59. DVD\n5. Change a CD\n6. Change a DVD\n7.Quit and display
  60. collection\n";
  61. cin >> choice;
  62. }
  63. quitManager(cdCollection, dvdCollection);
  64.  
  65. return 0;
  66. }
  67.  
  68. void addCD(LinkedList<CompactDisc> &cds)
  69. {
  70. string tempname;
  71. double temptime;
  72. string tempartist;
  73. CompactDisc tempdisk;
  74. cout << "\nEnter the name of the CD to add: ";
  75. cin.ignore();
  76. getline(cin, tempname);
  77. cout << "Enter the total length of the CD: ";
  78. cin >> temptime;
  79. cin.ignore();
  80. cout << "Enter the name of the CD artist: ";
  81. getline(cin, tempartist);
  82. tempdisk.setMediaName(tempname);
  83. tempdisk.setMediaLength(temptime);
  84. tempdisk.setArtistName(tempartist);
  85. cout << tempdisk.getMediaName();
  86. cds.appendNode(tempdisk);
  87. cout << "CD added\n";
  88. }
  89.  
  90. void addDVD(LinkedList<DigitalDisk> &dvds)
  91. {
  92. string tempname;
  93. double temptime;
  94. int tempyear;
  95. DigitalDisk tempdisk;
  96. cout << "\nEnter the name of the DVD to add: ";
  97. cin.ignore();
  98. getline(cin, tempname);
  99. cout << "Enter the length of the movie: ";
  100. cin >> temptime;
  101. cout << "Enter the year the movie was released: ";
  102. cin >> tempyear;
  103. tempdisk.setMediaName(tempname);
  104. tempdisk.setMediaLength(temptime);
  105. tempdisk.setYearReleased(tempyear);
  106. dvds.appendNode(tempdisk);
  107. cout << "DVD added\n";
  108. }
  109.  
  110. void subCD(LinkedList<CompactDisc> &cds)
  111. {
  112. string tempname;
  113. CompactDisc tempdisk;
  114. cout << "\nEnter the name of the CD to delete: ";
  115. cin.ignore();
  116. getline(cin, tempname);
  117. tempdisk.setMediaName(tempname);
  118. tempdisk = cds.searchList(tempdisk);
  119. if (tempdisk.getMediaLength() != 0)
  120. {
  121. cds.deleteNode(tempdisk);
  122. cout << "CD deleted\n";
  123. }
  124. else
  125. cout << "CD not in collection. Cannot Delete.\n";
  126. }
  127.  
  128. void subDVD(LinkedList<DigitalDisk> &dvds)
  129. {
  130. string tempname;
  131. DigitalDisk tempdisk;
  132. cout << "\nEnter the name of the movie to delete: ";
  133. cin.ignore();
  134. getline(cin, tempname);
  135. tempdisk.setMediaName(tempname);
  136. tempdisk = dvds.searchList(tempdisk);
  137. if (tempdisk.getMediaLength() != 0)
  138. {
  139. dvds.deleteNode(tempdisk);
  140. cout << "\nDVD deleted";
  141. }
  142. else
  143. cout << "\nDVD not in collection. Cannot Delete.";
  144. }
  145.  
  146. void modCD(LinkedList<CompactDisc> &cds)
  147. {
  148. int changeme;
  149. string tempname;
  150. CompactDisc tempdisc;
  151. cout << "\nEnter the name of a CD to change: ";
  152. cin.ignore();
  153. getline(cin, tempname);
  154. tempdisc.setMediaName(tempname);
  155. tempdisc = cds.searchList(tempdisc);
  156. while (tempdisc.getMediaLength() == 0)
  157. {
  158. cout << "\nEnter a valid name of a CD to change: ";
  159. cin.ignore();
  160. getline(cin, tempname);
  161. tempdisc.setMediaName(tempname);
  162. tempdisc = cds.searchList(tempdisc);
  163. }
  164. cout << "\nWhat would you like to change about this CD: ";
  165. cout << "\n1. Artist Name\n2.CD Length\n3. Add Song\n4. Delete
  166. Song\n5. CD Name\n6.Exit Modifier\n";
  167. cin >> changeme;
  168. cin.ignore();
  169. while (changeme != 6)
  170. {
  171. if (changeme == 1)
  172. {
  173. string tempname;
  174. cout << "\nEnter a new artist name: ";
  175. cin.ignore();
  176. getline(cin, tempname);
  177. tempdisc.setArtistName(tempname);
  178. cout << "\nName changed successfully";
  179. }
  180. else if (changeme == 2)
  181. {
  182. double temptime;
  183. cout << "\nEnter a new CD length: ";
  184. cin >> temptime;
  185. cin.ignore();
  186. tempdisc.setMediaLength(temptime);
  187. cout << "\nTime changed successfully";
  188. }
  189. else if (changeme == 3)
  190. {
  191. string tempname;
  192. double temptime;
  193. cout << "\nEnter a song name: ";
  194. cin.ignore();
  195. getline(cin, tempname);
  196. cout << "\nEnter a song length: ";
  197. cin >> temptime;
  198. cin.ignore();
  199. tempdisc.addSong(tempname, temptime);
  200. }
  201. else if (changeme == 4)
  202. {
  203. string tempname;
  204. cout << "\nEnter the name of a song to delete: ";
  205. getline(cin, tempname);
  206. if (tempdisc.deleteSong(tempname))
  207. {
  208. cout << "\nSong deleted successfully";
  209. }
  210. else
  211. cout << "\nSong does not exist in this CD to delete";
  212. }
  213. else
  214. {
  215. string tempname;
  216. cout << "\nEnter the new name of this CD: ";
  217. getline(cin, tempname);
  218. tempdisc.setMediaName(tempname);
  219. cout << "\nName changed successfully";
  220. }
  221. cout << "\nWhat would you like to change about this CD: ";
  222. cout << "\n1. Artist Name\n2.CD Length\n3. Add Song\n4. Delete
  223. Song\n5. CD Name\n6.Exit Modifier\n";
  224. cin >> changeme;
  225. cin.ignore();
  226. }
  227. cout << "\nNow exiting CD modifier...";
  228. }
  229.  
  230. void modDVD(LinkedList<DigitalDisk> &dvds)
  231. {
  232. int changeme;
  233. string tempname;
  234. DigitalDisk tempdisc;
  235. cout << "\nEnter the name of a DVD to change: ";
  236. cin.ignore();
  237. getline(cin, tempname);
  238. tempdisc.setMediaName(tempname);
  239. tempdisc = dvds.searchList(tempdisc);
  240. while (tempdisc.getMediaLength() == 0)
  241. {
  242. cout << "\nEnter a valid name of a DVD to change: ";
  243. getline(cin, tempname);
  244. tempdisc.setMediaName(tempname);
  245. tempdisc = dvds.searchList(tempdisc);
  246. }
  247. cout << "\nWhat would you like to change about this DVD: ";
  248. cout << "\n1. Actor or Character name\n2.DVD Length\n3. Add
  249. Actor/Character\n4. Delete ActorCharacter\n5. Year Released\n6. DVD
  250. name";
  251. cout << "\n7.Exit Modifier\n";
  252. cin >> changeme;
  253. cin.ignore();
  254. while (changeme != 7)
  255. {
  256. if (changeme == 1)
  257. {
  258. int whichtochange;
  259. cout << "\nChange: \n1. Actor name\n2.Character name";
  260. cin >> whichtochange;
  261. cin.ignore();
  262. if (whichtochange == 1)
  263. {
  264. string tempname;
  265. cout << "\nEnter a new actor name: ";
  266. cin.ignore();
  267. getline(cin, tempname);
  268. if (tempdisc.changeActor(tempname))
  269. cout << "\nActor changed successfully";
  270. else
  271. cout << "\nActor does not exist to change";
  272. }
  273. else
  274. {
  275. string tempaname;
  276. string tempcname;
  277. cout << "\nEnter an actor to change their character's name: ";
  278. cin.ignore();
  279. getline(cin, tempaname);
  280. cout << "\nEnter their new character's name: ";
  281. cin.ignore();
  282. getline(cin, tempcname);
  283. if (tempdisc.changeCharacter(tempaname, tempcname))
  284. cout << "\nCharacter changed successfully";
  285. else
  286. cout << "\nActor does not exist to change character name";
  287. }
  288. }
  289. else if (changeme == 2)
  290. {
  291. double temptime;
  292. cout << "\nEnter a new movie length: ";
  293. cin >> temptime;
  294. cin.ignore();
  295. tempdisc.setMediaLength(temptime);
  296. cout << "\nTime changed successfully";
  297. }
  298. else if (changeme == 3)
  299. {
  300. string tempaname;
  301. string tempcname;
  302. cout << "\nEnter a new actor name: ";
  303. getline(cin, tempaname);
  304. cout << "\nEnter a new character name: ";
  305. getline(cin, tempcname);
  306. tempdisc.addPlayer(tempaname, tempcname);
  307. }
  308. else if (changeme == 4)
  309. {
  310. string tempname;
  311. cout << "\nEnter the name of an actor to delete: ";
  312. if (tempdisc.deletePlayer(tempname))
  313. {
  314. cout << "\nActor deleted successfully";
  315. }
  316. else
  317. cout << "\nActor does not exist in this movie to delete";
  318. }
  319. else if (changeme == 5)
  320. {
  321. int tempyear;
  322. cout << "\nEnter a new year of release for this movie: ";
  323. cin >> tempyear;
  324. cin.ignore();
  325. tempdisc.setYearReleased(tempyear);
  326. cout << "\nYear changed successfully";
  327. }
  328. else
  329. {
  330. string tempname;
  331. cout << "Enter the new name of this DVD: ";
  332. getline(cin, tempname);
  333. tempdisc.setMediaName(tempname);
  334. cout << "\nName changed successfully";
  335. }
  336.  
  337. cout << "\nWhat would you like to change about this DVD: ";
  338. cout << "\n1. Actor or Character name\n2.DVD Length\n3. Add
  339. Actor/Character\n4. Delete ActorCharacter\n5. Year Released\n6. DVD
  340. name";
  341. cout << "\n7.Exit Modifier\n";
  342. cin >> changeme;
  343. cin.ignore();
  344. }
  345. cout << "\nNow exiting DVD modifier...";
  346. }
  347.  
  348. void quitManager(LinkedList<CompactDisc> &cds, LinkedList<DigitalDisk> &dvds)
  349. {
  350. cout << "\nThank you for using Media Manager. Your collection is as
  351. follows: " << endl << endl;
  352. cout << "DVD Collection\n ~~~~~~~~~~~~~~~~~~\n";
  353. cout << "Movie Title " << setw(20) << "Length of Movie" << setw(20)
  354. << "Year Released" << setw(10) << "Actors" << setw(10) << "Character";
  355. dvds.displayList();
  356.  
  357. cout << endl;
  358. }
  359. ----------------------------------------------
  360. #ifndef DIGITALDISK_H
  361. #define DIGITALDISK_H
  362. #include <iostream>
  363. #include <iomanip>
  364. #include <string>
  365. #include "LinkedList.h"
  366. #include "Media.h"
  367. #include "Player.h"
  368.  
  369. class DigitalDisk;
  370. ostream &operator << (ostream &, const DigitalDisk &);
  371.  
  372. class DigitalDisk : public Media
  373. {
  374. private:
  375. int yearReleased;
  376. LinkedList<Player> credits;
  377. public:
  378. DigitalDisk() :Media()
  379. {
  380. yearReleased = 0;
  381. }
  382. DigitalDisk(std::string mn, double ml, int yr) : Media(mn, ml)
  383. {
  384. yearReleased = yr;
  385. }
  386.  
  387. void setYearReleased(int yr)
  388. {
  389. yearReleased = yr;
  390. }
  391.  
  392. int getYearReleased()
  393. {
  394. return yearReleased;
  395. }
  396.  
  397. void addPlayer(string an, string cn)
  398. {
  399. Player temp;
  400. temp.setActorName(an);
  401. temp.setCharacterName(cn);
  402. credits.appendNode(temp);
  403. credits.displayList();
  404. cout << "\nActor/Character added";
  405. }
  406.  
  407. bool deletePlayer(std::string an)
  408. {
  409. Player temp;
  410. temp.setActorName(an);
  411. temp = credits.searchList(temp);
  412. if (temp.getCharacterName() != "")
  413. {
  414. credits.deleteNode(temp);
  415. return true;
  416. }
  417. else
  418. return false;
  419. }
  420.  
  421. bool changeActor(std::string an)
  422. {
  423. Player temp1;
  424. Player temp2;
  425. temp2.setActorName(an);
  426. temp2 = credits.searchList(temp2);
  427. if (temp2.getCharacterName() != "")
  428. {
  429. temp1 = temp2;
  430. temp1.setActorName(an);
  431. credits.deleteNode(temp2);
  432. credits.appendNode(temp1);
  433. return true;
  434. }
  435. else
  436. return false;
  437. }
  438.  
  439. bool changeCharacter(std::string an, std::string cn)
  440. {
  441. Player temp1;
  442. Player temp2;
  443. temp2.setActorName(an);
  444. temp2 = credits.searchList(temp2);
  445. if (temp2.getCharacterName() != "")
  446. {
  447. temp1 = temp2;
  448. temp1.setCharacterName(cn);
  449. credits.deleteNode(temp2);
  450. credits.appendNode(temp1);
  451. return true;
  452. }
  453. else
  454. return false;
  455. }
  456.  
  457. bool operator == (DigitalDisk &right)
  458. {
  459. if (mediaName == right.getMediaName())
  460. return true;
  461. else
  462. return false;
  463. }
  464.  
  465. bool operator != (DigitalDisk &right)
  466. {
  467. if (mediaName != right.getMediaName())
  468. return true;
  469. else
  470. return false;
  471. }
  472.  
  473. DigitalDisk operator = (DigitalDisk &right)
  474. {
  475. mediaName = right.getMediaName();
  476. mediaLength = right.getMediaLength();
  477. yearReleased = right.getYearReleased();
  478. return *this;
  479. }
  480.  
  481. void displayCredits()
  482. {
  483. credits.displayList();
  484. }
  485.  
  486. friend ostream &operator << (ostream & strm, const DigitalDisk &obj)
  487. {
  488. strm << endl << obj.mediaName << setw(10) << obj.mediaLength <<
  489. setw(10) << obj.yearReleased << setw(10);
  490. return strm;
  491. }
  492. };
  493. #endif
  494.  
  495. ----------------------------------------------
  496.  
  497. #ifndef COMPACTDISC_H
  498. #define COMPACTDISC_H
  499. #include <string>
  500. #include "LinkedList.h"
  501. #include "Media.h"
  502.  
  503. class CompactDisc : public Media
  504. {
  505. struct song
  506. {
  507. std::string songName;
  508. double songLength;
  509. bool operator ==(song &right)
  510. {
  511. if (songName == right.songName && songLength == right.songLength)
  512. return true;
  513. else
  514. return false;
  515. }
  516. bool operator !=(song &right)
  517. {
  518. if (songName != right.songName && songLength != right.songLength)
  519. return true;
  520. else
  521. return false;
  522. }
  523. song operator = (song &right)
  524. {
  525. song temp;
  526. temp.songName = right.songName;
  527. temp.songLength = right.songLength;
  528. return temp;
  529. }
  530. void displaySong()
  531. {
  532. cout << songName << songLength;
  533. }
  534. };
  535. private:
  536. LinkedList<song> setlist;
  537. std::string artistName;
  538. public:
  539. CompactDisc() : Media()
  540. {
  541. artistName = "";
  542. }
  543. CompactDisc(std::string mn, double ml, std::string an) : Media(mn, ml)
  544. {
  545. artistName = an;
  546. }
  547.  
  548. void setArtistName(std::string an)
  549. {
  550. artistName = an;
  551. }
  552.  
  553. std::string getArtistName()
  554. {
  555. return artistName;
  556. }
  557.  
  558. void addSong(std::string sn, double sl)
  559. {
  560. song temp;
  561. temp.songName = sn;
  562. temp.songLength = sl;
  563. setlist.appendNode(temp);
  564. }
  565.  
  566. bool deleteSong(std::string sn)
  567. {
  568. song temp;
  569. temp.songName = sn;
  570. temp = setlist.searchList(temp);
  571. if (temp.songLength != 0)
  572. {
  573. setlist.deleteNode(temp);
  574. return true;
  575. }
  576. else
  577. return false;
  578. }
  579.  
  580. bool operator == (CompactDisc &right)
  581. {
  582. if (mediaName == right.getMediaName())
  583. return true;
  584. else
  585. return false;
  586. }
  587.  
  588. bool operator != (CompactDisc &right)
  589. {
  590. if (mediaName != right.getMediaName())
  591. return true;
  592. else
  593. return false;
  594. }
  595.  
  596. CompactDisc operator = (CompactDisc &right)
  597. {
  598. mediaName = right.getMediaName();
  599. mediaLength = right.getMediaLength();
  600. artistName = right.getArtistName();
  601. return *this;
  602. }
  603.  
  604. };
  605. #endif;
  606.  
  607. ----------------------------------------------
  608.  
  609. #ifndef MEDIA_H
  610. #define MEDIA_H
  611. #include <iostream>
  612. #include <string>
  613. using namespace std;
  614.  
  615. class Media
  616. {
  617. protected:
  618. string mediaName;
  619. double mediaLength;
  620. public:
  621. Media()
  622. {
  623. mediaName = "";
  624. mediaLength = 0;
  625. }
  626. Media(string mn, double ml)
  627. {
  628. mediaName = mn;
  629. mediaLength = ml;
  630. }
  631.  
  632. void setMediaName(string mn)
  633. {
  634. mediaName = mn;
  635. }
  636.  
  637. void setMediaLength(double ml)
  638. {
  639. mediaLength = ml;
  640. }
  641.  
  642. string getMediaName()
  643. {
  644. return mediaName;
  645. }
  646.  
  647. double getMediaLength()
  648. {
  649. return mediaLength;
  650. }
  651.  
  652.  
  653. };
  654.  
  655. #endif
  656.  
  657. ----------------------------------------------
  658.  
  659. #ifndef PLAYER_H
  660. #define PLAYER_H
  661. #include <string>
  662. #include <iostream>
  663. #include <iomanip>
  664. using namespace std;
  665.  
  666. class Player;
  667. ostream &operator << (ostream &, const Player &);
  668.  
  669. class Player
  670. {
  671. private:
  672. string actorName;
  673. string characterName;
  674. public:
  675. Player()
  676. {
  677. actorName = "";
  678. characterName = "";
  679. }
  680.  
  681. void setActorName(string an)
  682. {
  683. actorName = an;
  684. }
  685.  
  686. void setCharacterName(string cn)
  687. {
  688. characterName = cn;
  689. }
  690.  
  691. string getCharacterName()
  692. {
  693. return characterName;
  694. }
  695.  
  696. string getActorName()
  697. {
  698. return actorName;
  699. }
  700.  
  701. bool operator == (Player &right)
  702. {
  703. if (actorName == right.getActorName())
  704. return true;
  705. else
  706. return false;
  707. }
  708. bool operator != (Player &right)
  709. {
  710. if (actorName != right.getActorName())
  711. return true;
  712. else
  713. return false;
  714. }
  715. Player operator = (Player &right)
  716. {
  717. actorName = right.getActorName();
  718. characterName = right.getCharacterName();
  719. return *this;
  720. }
  721.  
  722. inline friend ostream &operator << (ostream & strm, const Player &obj)
  723. {
  724. strm << setw(30) << obj.actorName << "/" << obj.characterName << endl;
  725. return strm;
  726. }
  727. };
  728.  
  729. #endif
  730.  
  731. ----------------------------------------------
  732.  
  733. //Class declaration for LinkedList. This class creates a
  734. //template class for a LinkedList that can be appended to,
  735. //have data inserted to or deleted from, and searched for a
  736. //position of a certain piece of data.
  737.  
  738. #ifndef LINKEDLIST_H
  739. #define LINKEDLIST_H
  740. #include <string>
  741. #include <iostream>
  742. using namespace std;
  743.  
  744. template<class T>
  745. class LinkedList
  746. {
  747. private:
  748. struct ListNode
  749. {
  750. T value;
  751. struct ListNode *next;
  752. };
  753.  
  754. ListNode *head;
  755. public:
  756. //Constructor that starts a new linked list.
  757. LinkedList()
  758. {
  759. head = nullptr;
  760. }
  761.  
  762. //Destructor that will destroy the list.
  763. ~LinkedList();
  764.  
  765. void appendNode(T);
  766. void insertNode(T);
  767. void deleteNode(T);
  768. void displayList() const;
  769. T searchList(T);
  770. };
  771.  
  772. //Function definition for appendNode
  773. //This function takes new information for a new list and
  774. //creates the list with the information entered in the order it
  775. //is recieved.
  776. template <class T>
  777. void LinkedList<T>::appendNode(T newValue)
  778. {
  779. ListNode *newNode;
  780. ListNode *nodePtr;
  781. newNode = new ListNode;
  782. newNode->value = newValue;
  783. newNode->next = nullptr;
  784. if (!head)
  785. head = newNode;
  786. else
  787. {
  788. nodePtr = head;
  789. while (nodePtr->next)
  790. nodePtr = nodePtr->next;
  791. nodePtr->next = newNode;
  792. }
  793. }
  794.  
  795. //Function definition for displayList.
  796. //This function shows the list as it sits.
  797. template <class T>
  798. inline void LinkedList<T>::displayList() const
  799. {
  800. ListNode *nodePtr;
  801. nodePtr = head;
  802. while (nodePtr)
  803. {
  804. cout << nodePtr->value;
  805. nodePtr = nodePtr->next;
  806. }
  807. }
  808.  
  809. //Function definition for insertNode.
  810. //This function will create and insert data into an
  811. //existing list. This function will insert the data
  812. //into the list in a sorted manner. I.E. if the list
  813. //is 4, 5, 7, 8, then 6 would be inserted in the middle.
  814. template <class T>
  815. void LinkedList<T>::insertNode(T newValue)
  816. {
  817. ListNode *newNode;
  818. ListNode *nodePtr;
  819. ListNode *previousNode = nullptr;
  820. newNode = new ListNode;
  821. newNode->value = newValue;
  822. if (!head)
  823. {
  824. head = newNode;
  825. newNode->next = nullptr;
  826. }
  827. else
  828. {
  829. nodePtr = head;
  830. previousNode = nullptr;
  831. while (nodePtr != nullptr && nodePtr->value < newValue)
  832. {
  833. previousNode = nodePtr;
  834. nodePtr = nodePtr->next;
  835. }
  836. if (previousNode == nullptr)
  837. {
  838. head = newNode;
  839. newNode->next = nodePtr;
  840. }
  841. else
  842. {
  843. previousNode->next = newNode;
  844. newNode->next = nodePtr;
  845. }
  846. }
  847. }
  848.  
  849. //Function definition for deleteNode.
  850. //This function searches for a specified node
  851. //and deletes it and the place of the node in the
  852. //list so there is not just one huge gap in the list.
  853. template <class T>
  854. void LinkedList<T>::deleteNode(T searchValue)
  855. {
  856. ListNode *nodePtr;
  857. ListNode *previousNode = nullptr;
  858. if (!head)
  859. return;
  860. if (head->value == searchValue)
  861. {
  862. nodePtr = head->next;
  863. delete head;
  864. head = nodePtr;
  865. }
  866. else
  867. {
  868. nodePtr = head;
  869. while (nodePtr != nullptr && nodePtr->value != searchValue)
  870. {
  871. previousNode = nodePtr;
  872. nodePtr = nodePtr->next;
  873. }
  874. if (nodePtr)
  875. {
  876. previousNode->next = nodePtr->next;
  877. delete nodePtr;
  878. }
  879. }
  880. }
  881.  
  882. //Destructor definition for class LinkedList.
  883. //This destructor destroys the whole list.
  884. template <class T>
  885. LinkedList<T>::~LinkedList()
  886. {
  887. ListNode *nodePtr;
  888. ListNode *nextNode;
  889. nodePtr = head;
  890. while (nodePtr != nullptr)
  891. {
  892. nextNode = nodePtr->next;
  893. delete nodePtr;
  894. nodePtr = nextNode;
  895. }
  896. }
  897.  
  898. //Function definition for searchList.
  899. //This function searches for a specified data member.
  900. //If the number is found it returns the place of the data.
  901. //If the searched for is not found, then it returns negative 1.
  902. template <class T>
  903. T LinkedList<T>::searchList(T searchValue)
  904. {
  905. ListNode *nodePtr;
  906. nodePtr = head;
  907. while (nodePtr != nullptr)
  908. {
  909. if (nodePtr-> value == searchValue)
  910. {
  911. searchValue = nodePtr->value;
  912. return searchValue;
  913. }
  914. nodePtr = nodePtr->next;
  915. }
  916. return searchValue;
  917. }
  918.  
  919.  
  920. #endif
  921. <!DOCTYPE html>
  922. <html lang="en-US">
  923. <head>
  924. <title>Tryit Editor v3.0</title>
  925. <meta name="viewport" content="width=device-width">
  926. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  927. <link rel="stylesheet" href="/lib/w3.css">
  928. <script src="/lib/w3codecolor.js"></script>
  929. <script>
  930. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  931. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  932. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  933. })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  934. ga('create', 'UA-3855518-1', 'auto');
  935. ga('require', 'displayfeatures');
  936. ga('send', 'pageview');
  937. </script>
  938. <script>
  939. var googletag = googletag || {};
  940. googletag.cmd = googletag.cmd || [];
  941. (function() {
  942. var gads = document.createElement('script');
  943. gads.async = true;
  944. gads.type = 'text/javascript';
  945. var useSSL = 'https:' == document.location.protocol;
  946. gads.src = (useSSL ? 'https:' : 'http:') +
  947. '//www.googletagservices.com/tag/js/gpt.js';
  948. var node = document.getElementsByTagName('script')[0];
  949. node.parentNode.insertBefore(gads, node);
  950. })();
  951. </script>
  952. <script type='text/javascript'>
  953. // GPT slots
  954. var gptAdSlots = [];
  955. googletag.cmd.push(function() {
  956.  
  957. var leaderMapping = googletag.sizeMapping().
  958. // Mobile ad
  959. addSize([0, 0], [320, 50]).
  960. // Vertical Tablet ad
  961. addSize([468, 0], [468, 60]).
  962. // Horizontal Tablet
  963. addSize([728, 0], [728, 90]).
  964. // Desktop and bigger ad
  965. addSize([970, 0], [[728, 90], [970, 90]]).build();
  966. // addSize([970, 0], [728, 90]).build();
  967. gptAdSlots[0] = googletag.defineSlot('/16833175/TryitLeaderboard',
  968. [[728, 90], [970, 90]], 'div-gpt-ad-1428407818244-0').
  969. // gptAdSlots[0] = googletag.defineSlot('/16833175/TryitLeaderboard',
  970. [728, 90], 'div-gpt-ad-1428407818244-0').
  971. defineSizeMapping(leaderMapping).addService(googletag.pubads());
  972.  
  973.  
  974. googletag.pubads().setTargeting("content","tryangular");
  975. googletag.enableServices();
  976. });
  977. </script>
  978. <script>
  979. if (window.addEventListener) {
  980. window.addEventListener("resize", browserResize);
  981. } else if (window.attachEvent) {
  982. window.attachEvent("onresize", browserResize);
  983. }
  984. var xbeforeResize = window.innerWidth;
  985.  
  986. function browserResize() {
  987. var afterResize = window.innerWidth;
  988. if ((xbeforeResize < (970) && afterResize >= (970)) ||
  989. (xbeforeResize >= (970) && afterResize < (970)) ||
  990. (xbeforeResize < (728) && afterResize >= (728)) ||
  991. (xbeforeResize >= (728) && afterResize < (728)) ||
  992. (xbeforeResize < (468) && afterResize >= (468))
  993. ||(xbeforeResize >= (468) && afterResize < (468))) {
  994. xbeforeResize = afterResize;
  995. googletag.cmd.push(function() {
  996. googletag.pubads().refresh([gptAdSlots[0]]);
  997. });
  998. }
  999. if (window.screen.availWidth <= 768) {
  1000. restack(window.innerHeight > window.innerWidth);
  1001. }
  1002. fixDragBtn();
  1003. }
  1004. </script>
  1005. <style>
  1006. * {
  1007. -webkit-box-sizing: border-box;
  1008. -moz-box-sizing: border-box;
  1009. box-sizing: border-box;
  1010. }
  1011. body {
  1012. color:#000000;
  1013. margin:0px;
  1014. font-size:100%;
  1015. }
  1016. .trytopnav {
  1017. height:40px;
  1018. overflow:hidden;
  1019. min-width:600px;
  1020. position:absolute;
  1021. width:100%;
  1022. top:99px;
  1023. }
  1024. .w3-navbar button {
  1025. border:none;
  1026. padding:8px 16px;
  1027. display:block;
  1028. }
  1029. a.w3schoolslink {
  1030. padding:0 !important;
  1031. display:inline !important;
  1032. }
  1033. a.w3schoolslink:hover,a.w3schoolslink:active {
  1034. text-decoration:underline !important;
  1035. background-color:transparent !important;
  1036. }
  1037. #dragbar{
  1038. position:absolute;
  1039. cursor: col-resize;
  1040. z-index:3;
  1041. padding:5px;
  1042. }
  1043. #shield {
  1044. display:none;
  1045. top:0;
  1046. left:0;
  1047. width:100%;
  1048. position:absolute;
  1049. height:100%;
  1050. z-index:4;
  1051. }
  1052. #container {
  1053. background-color:#f1f1f1;
  1054. width:100%;
  1055. overflow:auto;
  1056. position:absolute;
  1057. top:138px;
  1058. bottom:0;
  1059. height:auto;
  1060. }
  1061. #textareacontainer, #iframecontainer {
  1062. float:left;
  1063. height:100%;
  1064. width:50%;
  1065. }
  1066. #textarea, #iframe {
  1067. height:100%;
  1068. width:100%;
  1069. padding-bottom:10px;
  1070. padding-top:1px;
  1071. }
  1072. #textarea {
  1073. padding-left:10px;
  1074. padding-right:5px;
  1075. }
  1076. #iframe {
  1077. padding-left:5px;
  1078. padding-right:10px;
  1079. }
  1080. #textareawrapper {
  1081. width:100%;
  1082. height:100%;
  1083. background-color: #ffffff;
  1084. position:relative;
  1085. box-shadow:0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  1086. }
  1087. #iframewrapper {
  1088. width:100%;
  1089. height:100%;
  1090. -webkit-overflow-scrolling: touch;
  1091. background-color: #ffffff;
  1092. box-shadow:0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  1093. }
  1094. #textareaCode {
  1095. background-color: #ffffff;
  1096. font-family: consolas,"courier new",monospace;
  1097. font-size:15px;
  1098. height:100%;
  1099. width:100%;
  1100. padding:8px;
  1101. resize: none;
  1102. border:none;
  1103. line-height:normal;
  1104. }
  1105. textarea.textareaCC {
  1106. background-color:transparent !important;
  1107. z-index:2;
  1108. position:relative;
  1109. -webkit-text-fill-color: transparent;
  1110. line-height:normal;
  1111. }
  1112. .codecolorCC {
  1113. position:absolute;
  1114. font-family: consolas,"courier new",monospace;
  1115. font-size: 15px;
  1116. height: 100%;
  1117. width: 100%;
  1118. padding: 8px;
  1119. resize: none;
  1120. border: none;
  1121. z-index: 1;
  1122. overflow-y:auto;
  1123. word-wrap: break-word;
  1124. line-height:normal;
  1125. }
  1126. #iframeResult, #iframeSource {
  1127. background-color: #ffffff;
  1128. height:100%;
  1129. width:100%;
  1130. }
  1131. #stackV {background-color:#999999;}
  1132. #stackV.horizontal,#stackV.horizontal {background-color:transparent;}
  1133. #stackV.horizontal:hover {background-color:#d3d3d3;}
  1134. #stackH,#stackH {background-color:transparent;}
  1135. #stackH:hover {background-color:#d3d3d3;}
  1136. #stackH.horizontal {background-color:#999999;}
  1137. #textareacontainer.horizontal,#iframecontainer.horizontal{
  1138. height:50%;
  1139. float:none;
  1140. width:100%;
  1141. }
  1142. #textarea.horizontal{
  1143. height:100%;
  1144. padding-left:10px;
  1145. padding-right:10px;
  1146. }
  1147. #iframe.horizontal{
  1148. height:100%;
  1149. padding-right:10px;
  1150. padding-bottom:10px;
  1151. padding-left:10px;
  1152. }
  1153. #container.horizontal{
  1154. min-height:200px;
  1155. margin-left:0;
  1156. }
  1157. #tryitLeaderboard {
  1158. overflow:hidden;
  1159. text-align:center;
  1160. margin-top:5px;
  1161. height:90px;
  1162. }
  1163. @media screen and (max-width: 727px) {
  1164. .trytopnav {top:70px;}
  1165. #container {top:108px;}
  1166. }
  1167. @media screen and (max-width: 467px) {
  1168. .trytopnav {top:60px;}
  1169. #container {top:98px;}
  1170. }
  1171. @media only screen and (max-device-width: 768px) {
  1172. #iframewrapper {overflow: auto;}
  1173. #container {min-width:320px;}
  1174. .stack {display:none;}
  1175. }
  1176. #iframewrapper {
  1177.  
  1178. }
  1179. </style>
  1180. <!--[if lt IE 8]>
  1181. <style>
  1182. #textareacontainer, #iframecontainer {width:48%;}
  1183. #container {height:500px;}
  1184. #textarea, #iframe {width:90%;height:450px;}
  1185. #textareaCode, #iframeResult {height:450px;}
  1186. .stack {display:none;}
  1187. </style>
  1188. <![endif]-->
  1189. </head>
  1190. <body>
  1191. <div id='tryitLeaderboard' style="background-color:#ffffff">
  1192. <!-- TryitLeaderboard -->
  1193. <div id='div-gpt-ad-1428407818244-0'>
  1194. <script type='text/javascript'>googletag.cmd.push(function() {
  1195. googletag.display('div-gpt-ad-1428407818244-0'); });</script>
  1196. </div>
  1197. </div>
  1198.  
  1199. <div class="trytopnav">
  1200. <ul class="w3-navbar w3-light-grey" style="border-top:1px solid #f1f1f1;">
  1201. <li style="width:auto !important;float:left;"><span
  1202. style="padding:8px 16px 8px 10px;display:block">Edit The
  1203. Code:</span></li>
  1204. <li class="stack" style="width:auto !important;float:left;"><button
  1205. title="Vertically" onclick="restack(false)" id="stackV"><img
  1206. src="/images/stack_vertically.png"></button></li>
  1207. <li class="stack" style="width:auto !important;float:left;"><button
  1208. title="Horizontally" onclick="restack(true)" id="stackH"><img
  1209. src="/images/stack_horizontally.png"></button></li>
  1210. <li style="width:auto !important;float:left;"><button
  1211. class="w3-green w3-hover-white w3-hover-text-green"
  1212. onclick="submitTryit()">See Result &raquo;</button></li>
  1213. <li class="w3-right w3-hide-small"><span style="padding:8px
  1214. 16px;display:block">Try it Yourself - &copy; <a
  1215. href="http://www.w3schools.com"
  1216. class="w3schoolslink">w3schools.com</a></span></li>
  1217. </ul>
  1218. </div>
  1219. <div id="shield"></div>
  1220. <a href="javascript:void(0)" id="dragbar"></a>
  1221. <div id="container">
  1222. <div id="textareacontainer">
  1223. <div id="textarea">
  1224. <div id="textareawrapper">
  1225. <div id="codecolor"></div>
  1226. <textarea autocomplete="off" id="textareaCode" wrap="logical"
  1227. spellcheck="false"><!DOCTYPE html>
  1228. <html>
  1229. <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
  1230. <body>
  1231.  
  1232. <div ng-app="myApp" ng-controller="customersCtrl">
  1233.  
  1234. <table>
  1235. <tr ng-repeat="x in names">
  1236. <td>{{ x.Name }}</td>
  1237. <td>{{ x.Country }}</td>
  1238. </tr>
  1239. </table>
  1240.  
  1241. </div>
  1242.  
  1243. <script>
  1244. var app = angular.module('myApp', []);
  1245. app.controller('customersCtrl', function($scope, $http) {
  1246. $http.get("http://www.w3schools.com/angular/customers.php")
  1247. .then(function (response) {$scope.names = response.data.records;});
  1248. });
  1249. </script>
  1250.  
  1251. </body>
  1252. </html>
  1253. </textarea>
  1254. <form autocomplete="off" style="margin:0px;display:none;">
  1255. <input type="hidden" name="code" id="code" />
  1256. <input type="hidden" id="bt" name="bt" />
  1257. </form>
  1258. </div>
  1259. </div>
  1260. </div>
  1261. <div id="iframecontainer">
  1262. <div id="iframe">
  1263. <div id="iframewrapper"></div>
  1264. </div>
  1265. </div>
  1266. </div>
  1267. <script>
  1268. submitTryit()
  1269. function submitTryit() {
  1270. var text = document.getElementById("textareaCode").value;
  1271. var ifr = document.createElement("iframe");
  1272. ifr.setAttribute("frameborder", "0");
  1273. ifr.setAttribute("id", "iframeResult");
  1274. document.getElementById("iframewrapper").innerHTML = "";
  1275. document.getElementById("iframewrapper").appendChild(ifr);
  1276. var ifrw = (ifr.contentWindow) ? ifr.contentWindow :
  1277. (ifr.contentDocument.document) ? ifr.contentDocument.document :
  1278. ifr.contentDocument;
  1279. ifrw.document.open();
  1280. ifrw.document.write(text);
  1281. ifrw.document.close();
  1282. //23.02.2016: contentEditable is set to true, to fix text-selection
  1283. (bug) in firefox.
  1284. //(and back to false to prevent the content from being editable)
  1285. //(To reproduce the error: Select text in the result window with,
  1286. and without, the contentEditable statements below.)
  1287. if (ifrw.document.body && !ifrw.document.body.isContentEditable) {
  1288. ifrw.document.body.contentEditable = true;
  1289. ifrw.document.body.contentEditable = false;
  1290. }
  1291. }
  1292. function restack(horizontal) {
  1293. var tc, ic, t, i, c, f, sv, sh, d, height, flt, width;
  1294. tc = document.getElementById("textareacontainer");
  1295. ic = document.getElementById("iframecontainer");
  1296. t = document.getElementById("textarea");
  1297. i = document.getElementById("iframe");
  1298. c = document.getElementById("container");
  1299. sv = document.getElementById("stackV");
  1300. sh = document.getElementById("stackH");
  1301. tc.className = tc.className.replace("horizontal", "");
  1302. ic.className = ic.className.replace("horizontal", "");
  1303. t.className = t.className.replace("horizontal", "");
  1304. i.className = i.className.replace("horizontal", "");
  1305. c.className = c.className.replace("horizontal", "");
  1306. sv.className = sv.className.replace("horizontal", "");
  1307. sh.className = sh.className.replace("horizontal", "");
  1308. stack = "";
  1309. if (horizontal) {
  1310. tc.className = tc.className + " horizontal";
  1311. ic.className = ic.className + " horizontal";
  1312. t.className = t.className + " horizontal";
  1313. i.className = i.className + " horizontal";
  1314. c.className = c.className + " horizontal";
  1315. sv.className = sv.className + " horizontal";
  1316. sh.className = sh.className + " horizontal";
  1317. stack = " horizontal";
  1318. document.getElementById("textareacontainer").style.height = "50%";
  1319. document.getElementById("iframecontainer").style.height = "50%";
  1320. document.getElementById("textareacontainer").style.width = "100%";
  1321. document.getElementById("iframecontainer").style.width = "100%";
  1322. } else {
  1323. document.getElementById("textareacontainer").style.height = "100%";
  1324. document.getElementById("iframecontainer").style.height = "100%";
  1325. document.getElementById("textareacontainer").style.width = "50%";
  1326. document.getElementById("iframecontainer").style.width = "50%";
  1327. }
  1328. fixDragBtn();
  1329. }
  1330. if (navigator.userAgent.indexOf("WebKit") > -1 &&
  1331. navigator.userAgent.indexOf("Edge") == -1) {
  1332. document.getElementById("codecolor").className += " codecolorCC";
  1333. document.getElementById("textareaCode").className += " textareaCC";
  1334. colorcoding();
  1335. if (document.getElementById("textareaCode").addEventListener) {
  1336. document.getElementById("textareaCode").addEventListener("input",
  1337. colorcoding);
  1338. document.getElementById("textareaCode").addEventListener("scroll",
  1339. syncscroll);
  1340. } else if (document.getElementById("textareaCode").attachEvent) {
  1341. document.getElementById("textareaCode").attachEvent("oninput",
  1342. colorcoding);
  1343. document.getElementById("textareaCode").attachEvent("onscroll",
  1344. syncscroll);
  1345. }
  1346. }
  1347. function syncscroll() {
  1348. document.getElementById("codecolor").scrollTop =
  1349. document.getElementById("textareaCode").scrollTop;
  1350. }
  1351. function colorcoding() {
  1352. var text = document.getElementById("textareaCode").value;
  1353. text = text.replace(/&/g, "&amp;");
  1354. text = text.replace(/\t/g,
  1355. "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  1356. text = text.replace(/ /g, " &nbsp;");
  1357. text = text.replace(/</g, "&lt;");
  1358. text = text.replace(/>/g, "&gt;");
  1359. text = text.replace(/(?:\r\n|\r|\n)/g, '<br>');
  1360. text = text.replace(/<br> /g, "<br>&nbsp;");
  1361. text = w3CodeColorize(text);
  1362. document.getElementById("codecolor").innerHTML = text + "<br><br>";
  1363. }
  1364. var i = 0;
  1365. var dragging = false;
  1366. var buttonwidth;
  1367. var stack;
  1368. if ((window.screen.availWidth <= 768 && window.innerHeight >
  1369. window.innerWidth) || "" == " horizontal") {restack(true);}
  1370. function fixDragBtn() {
  1371. var textareawidth, leftpadding, dragleft, containertop
  1372. var containertop =
  1373. Number(w3_getStyleValue(document.getElementById("container"),
  1374. "top").replace("px", ""));
  1375. if (stack != " horizontal") {
  1376. document.getElementById("dragbar").style.width = "5px";
  1377. textareasize =
  1378. Number(w3_getStyleValue(document.getElementById("textareaCode"),
  1379. "width").replace("px", ""));
  1380. leftpadding =
  1381. Number(w3_getStyleValue(document.getElementById("textarea"),
  1382. "padding-left").replace("px", ""));
  1383. buttonwidth =
  1384. Number(w3_getStyleValue(document.getElementById("dragbar"),
  1385. "width").replace("px", ""));
  1386. textareaheight =
  1387. w3_getStyleValue(document.getElementById("textareaCode"), "height");
  1388. dragleft = textareasize + leftpadding + (leftpadding / 2) -
  1389. (buttonwidth / 2);
  1390. document.getElementById("dragbar").style.top = containertop + "px";
  1391. document.getElementById("dragbar").style.left = dragleft + "px";
  1392. document.getElementById("dragbar").style.height = textareaheight;
  1393. document.getElementById("dragbar").style.cursor = "col-resize";
  1394.  
  1395. } else {
  1396. document.getElementById("dragbar").style.height = "5px";
  1397. if (window.getComputedStyle) {
  1398. textareawidth =
  1399. window.getComputedStyle(document.getElementById("textareaCode"),null).getPropertyValue("height");
  1400. textareaheight =
  1401. window.getComputedStyle(document.getElementById("textareaCode"),null).getPropertyValue("width");
  1402. leftpadding =
  1403. window.getComputedStyle(document.getElementById("textarea"),null).getPropertyValue("padding-top");
  1404. buttonwidth =
  1405. window.getComputedStyle(document.getElementById("dragbar"),null).getPropertyValue("height");
  1406. } else {
  1407. dragleft =
  1408. document.getElementById("textareaCode").currentStyle["width"];
  1409. }
  1410. textareawidth = Number(textareawidth.replace("px", ""));
  1411. leftpadding = Number(leftpadding .replace("px", ""));
  1412. buttonwidth = Number(buttonwidth .replace("px", ""));
  1413. dragleft = containertop + textareawidth + leftpadding + (leftpadding / 2);
  1414. document.getElementById("dragbar").style.top = dragleft + "px";
  1415. document.getElementById("dragbar").style.left = "5px";
  1416. document.getElementById("dragbar").style.width = textareaheight;
  1417. document.getElementById("dragbar").style.cursor = "row-resize";
  1418. }
  1419. }
  1420. function dragstart(e) {
  1421. e.preventDefault();
  1422. dragging = true;
  1423. var main = document.getElementById("iframecontainer");
  1424. }
  1425. function dragmove(e) {
  1426. if (dragging)
  1427. {
  1428. document.getElementById("shield").style.display = "block";
  1429. if (stack != " horizontal") {
  1430. var percentage = (e.pageX / window.innerWidth) * 100;
  1431. if (percentage > 5 && percentage < 98) {
  1432. var mainPercentage = 100-percentage;
  1433. document.getElementById("textareacontainer").style.width =
  1434. percentage + "%";
  1435. document.getElementById("iframecontainer").style.width =
  1436. mainPercentage + "%";
  1437. fixDragBtn();
  1438. }
  1439. } else {
  1440. var containertop =
  1441. Number(w3_getStyleValue(document.getElementById("container"),
  1442. "top").replace("px", ""));
  1443. var percentage = ((e.pageY - containertop + 20) /
  1444. (window.innerHeight - containertop + 20)) * 100;
  1445. if (percentage > 5 && percentage < 98) {
  1446. var mainPercentage = 100-percentage;
  1447. document.getElementById("textareacontainer").style.height =
  1448. percentage + "%";
  1449. document.getElementById("iframecontainer").style.height =
  1450. mainPercentage + "%";
  1451. fixDragBtn();
  1452. }
  1453. }
  1454. }
  1455. }
  1456. function dragend() {
  1457. document.getElementById("shield").style.display = "none";
  1458. dragging = false;
  1459. }
  1460. if (window.addEventListener) {
  1461. document.getElementById("dragbar").addEventListener("mousedown",
  1462. function(e) {dragstart(e);});
  1463. document.getElementById("dragbar").addEventListener("touchstart",
  1464. function(e) {dragstart(e);});
  1465. window.addEventListener("mousemove", function(e) {dragmove(e);});
  1466. window.addEventListener("touchmove", function(e) {dragmove(e);});
  1467. window.addEventListener("mouseup", dragend);
  1468. window.addEventListener("touchend", dragend);
  1469. window.addEventListener("load", fixDragBtn);
  1470. }
  1471. function w3_getStyleValue(elmnt,style) {
  1472. if (window.getComputedStyle) {
  1473. return window.getComputedStyle(elmnt,null).getPropertyValue(style);
  1474. } else {
  1475. return elmnt.currentStyle[style];
  1476. }
  1477. }
  1478. </script>
  1479. </body>
  1480. </html>
Add Comment
Please, Sign In to add comment