Vous êtes sur la page 1sur 5

Creating a Hello, World!

Program in XCode
Introduction
Traditionally, the first example that any new computer programmer learns is known as
the Hello, World! program. Its functionality is simple: to display the phrase Hello,
World! to the user. The purpose is to give a very simple example of the syntax of the
programming language and introduce the programmer to a few of the languages core
concepts. The following manual provides step-by-step instructions to writing your own
version of Hello, World! in the C++ programming language, using the development
environment, Xcode.
Steps
1. On you Mac, launch the Spotlight Search feature by entering Command +
Space Bar

2. In the textbox, type XCode


Select the application icon in the right corner

3. On the main screen, Select Create a new Xcode project

4. Highlight the Command Line Tool icon under the Application section

In the bottom right corner, click the Next button

5. Enter the following information and click the Next button:


Product Name: the title of your application
Team (optional): the name of your development team
Organization Name: the name of the organization you represent
i. You may enter your name if you are not affiliated with any
organization
Organization Identifier: the identifier of the organization you represent
i. You may enter your name if you are not affiliated with any
organization
Language: Select C++

6. Select the directory where you would like to save the project

7. In the upper left corner, select the main.cpp file to view source code

**Warning***: The following sections include the code (highlighted in RED) needed to
execute the program. It is REQUIRED that you follow each line exactly as it is
displayed (including punctuation). Failure to do so may prevent program from executing
properly!
8. Enter the following two lines at the top of the program:
#include < iostream >
using namespace std;

9. Inside the brackets, enter the following line:


cout << Hello, World! << endl;

10. Press the


hand corner

button to build and run the program (located in the upper-left

11. If executed correctly, you should see the output in the lower-right hand corner.

Congratulations! You have created your first computer program. You should
hopefully have a better understanding of how to launch an application in XCode and
some of the basics of coding in the C++ programming language. Use the resources
below for more information on enhancing your programming skills:

C++ for Beginners: https://www.tutorialspoint.com/cplusplus/


XCode for Beginners: https://www.raywenderlich.com/110170/mac-os-xdevelopment-tutorial-for-beginners-part-1-intro-to-xcode

Vous aimerez peut-être aussi