Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Hello World!

---
jupytext:
  formats: md:myst
  text_representation:
    extension: .md
    format_name: myst
kernelspec:
  display_name: Python 3
  language: python
  name: python3
---

Hello World!

Adapted from: “Object-Oriented Programming Using C++” by Ira Pohl (Addison- Wesley)

Program to Display Hello World!

// Hello world in C++
#include <iostream>
#include <string>

using namespace std;

inline void pr_message(string s = "Hello World!")
{
    cout << s << endl;
}

int main()
{
    pr_message();
}

The above program is compiled and run using Gnu Compiler Collection (g++):

import os
root_dir = os.getcwd()
code_dir = root_dir + "/" + "Cpp_Code/Hello"
os.chdir(code_dir)
build_command = os.system("g++ hello.cpp -w -o hello")
exec_status = os.system("./hello")
Hello World!