Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
For 2023 - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Hello World in C++ - a first program, with the process explained

"Hello World" programs - traditionally (a good tradition) te first example on a proogramming course in any language - just output the words "Hello World" or similar text and do little else. They show learners / students / delegates the mechanism of working with a language in te simplest possible example - how to enter the code, how to turn the code into something that can be run, and how to actually run it.

Here's a "hello world" program in C++ - this text being entered into a file with an extenstion ".c++" or ".cpp" using your "favourite text editor". Use gedit, use notepad or notepad++, use emacs, nano or vi. (This text is know as the souce code)

  #include <iostream>
  using namespace std;
  int main() {
     cout << "Welcome - and enjoy your C++ course" << endl;

In C++, having entered the file of text you need to convert it into an "executable program" - a file of instructions for that the processor of your computer understands rather than the English-like (!) language of C++. This process is known as "compiling" and on Unix / inux / OSX systems the easiest way is often the "make" utility:

  WomanWithCat:harwell grahamellis$ make hw
  c++ hw.cpp -o hw
  WomanWithCat:harwell grahamellis$

The resultant file - called hw in our example - can then be run as follows:

  WomanWithCat:harwell grahamellis$ ./hw
  Welcome - and enjoy your C++ course
  WomanWithCat:harwell grahamellis$

An exercise such as this may appear trivial, but it lets delegates who are using our systems (or who are new to the tools on thei own systems) get a first bite at using the elements and pasting them together - and those who are used to scripting or pseudo-scripting languages to come to terms with the need for an extra compile stage for C or C++.

Source code at [here].
(written 2015-10-30)

Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
C231 - C and C based languages - Introduction to C++
  [317] Programming languages - a comparison - (2005-05-20)
  [318] Choosing a theme - (2005-05-20)
  [336] Targetted Advertising - (2005-06-05)
  [928] C++ and Perl - why did they do it THAT way? - (2006-11-16)
  [2004] Variable Scope in C++ - (2009-01-22)
  [2169] When should I use OO techniques? - (2009-05-11)
  [2845] Objects and Inheritance in C++ - an easy start - (2010-07-01)
  [3052] Getting your C++ program to run - (2010-11-15)
  [3053] Make - automating the commands for building and installing - (2010-11-16)
  [3069] Strings, Garbage Collection and Variable Scope in C++ - (2010-11-25)
  [3250] C++ - how we teach the language and the concepts behind the language - (2011-04-17)
  [4466] Moving from C to C++ - Structured to Object Oriented - a lesson for engineers - (2015-03-28)
  [4562] Left shift operator on an output stream object - C++ - (2015-10-30)

Back to
Variables, Pointers and References - C and C++
Previous and next
Horse's mouth home
Forward to
Left shift operator on an output stream object - C++
Some other Articles
Allocation of memory for objects in C++ - Stack v Heap
Perl, PHP, Python, Lua, Tcl, C++, Ruby - final public courses for 2015
Formatting and outputting your own classes in C++
Hello World in C++ - a first program, with the process explained
Variables, Pointers and References - C and C++
When do I use the this keyword in C++?
Well House Consultants - Python courses / what's special.
Function prototype - what they are and why you should use them - C and C++
Strings in C - strncmp strncpy and friends
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page

This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2023: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/4561_.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb