Here I show how to print to screen the classic phrase "Hello, World!" using Python, C, and C++. I am using
a Mac and the Terminal window.
Hello, World! in Python
File structure for Python program
# This Python program prints Hello, World!
print("Hello, World! \n")
Python code
Running Python script from Terminal
Hello, World! in the C Programming Language
File structure for C program - before compiling
File structure for C program - after compiling
/* This C program prints Hello, World! */
#include<stdio.h>
int main(void)
{
printf("Hello World \n");
return 0;
}
C code
Compiling and running C program from Terminal
Hello, World! in C++
File structure for C++ program - before compiling
File structure for C++ program - after compiling
// This C++ program prints Hello, World!
#include <iostream>
int main()
{
std::cout << "Hello, World! \n";
return 0;
}
C++ code
Compiling and running C++ program from Terminal