C++ examples

Though I am not coding in C++ and my experience in these languages is minor, I am ofter asked to help students with the studies in the subject. So was the case recently, so I ended up writing two small programs: one has to do with link lists and few functions to work with them like push, pop, insert, remove, sort, print, search and the other one is a classic thing with drawing triangular from star (or any other) symbol.

Just in case someone is learning C++ now, you can download the code and go through, hope it will help or give an idea.

So here is the link_list.cpp stuff and here is a star.cpp.

BTW, those who are using Windows and something like DevC++ often can see a call to system(‘PAUSE’) which is really bad and works only on Windows. While doing link list thing, I did a function called user_wait(), which does the same, but  in more natural way, here it is:

  /* waits for user to press Enter. Good replacement for system('PAUSE') which works only on Windows */
  void user_wait ()  {
      char blah;

      std::cout << std::endl << "... Press Enter to Continue ..." << std::endl; // print msg
      std::cin.get(blah); // wait for Enter
      std::cout << std::endl; // put newline
  }