From mboxrd@z Thu Jan 1 00:00:00 1970 From: Amos Bird Subject: evaluate cpp snippet in org babel with default includes and customized entry point Date: Sat, 16 Sep 2017 15:50:54 +0800 Message-ID: <877ewz9j4x.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dt7sS-0003JY-ON for emacs-orgmode@gnu.org; Sat, 16 Sep 2017 03:51:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dt7sR-0007Tt-9O for emacs-orgmode@gnu.org; Sat, 16 Sep 2017 03:51:00 -0400 Received: from mail-pf0-x22d.google.com ([2607:f8b0:400e:c00::22d]:43277) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dt7sR-0007Tn-2A for emacs-orgmode@gnu.org; Sat, 16 Sep 2017 03:50:59 -0400 Received: by mail-pf0-x22d.google.com with SMTP id y29so2544603pff.0 for ; Sat, 16 Sep 2017 00:50:58 -0700 (PDT) Received: from localhost ([2604:180:3:28::c542]) by smtp.gmail.com with ESMTPSA id g5sm5335930pgo.66.2017.09.16.00.50.57 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 16 Sep 2017 00:50:57 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode --=-=-= Content-Type: text/plain #+OPTIONS: latex:t toc:nil H:3 Hi I'd like to write a blog about leetcode solutions in c++. How can I evaluate those c++ code snippet using org babel? * Array ** Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1]. #+BEGIN_SRC cpp class Solution { public: vector twoSum(vector& nums, int target) { } }; #+END_SRC #+RESULTS: I need to add default headers and pass arguments to the entry class. -- Amos Bird amosbird@gmail.com --=-=-= Content-Type: multipart/related; boundary="==-=-=" --==-=-= Content-Type: text/html

Hi

I'd like to write a blog about leetcode solutions in c++. How can I evaluate those c++ code snippet using org babel?

1 Array

1.1 Two Sum

Given an array of integers, return indices of the two numbers such that they add up to a specific target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

Example:
Given nums = [2, 7, 11, 15], target = 9,

Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].

class Solution {
public:
    vector<int> twoSum(vector<int>& nums, int target) {

    }
};

I need to add default headers and pass arguments to the entry class.


Amos Bird
amosbird@gmail.com

--==-=-=-- --=-=-=--