在 C++ 中嵌入 BASIC 脚本 basicpp

码农软件 · 软件分类 · 脚本编程语言 · 2019-03-04 16:58:57

软件介绍

basicpp 使得今天的 C++ 可以像 80 年代的 BASIC 语言一样的简单。该项目在了 C++ 中实现了简单的 BASIC 仿真。

示例代码:

#include "basic.hpp"

int main()
{
  _10: LET X = 1;
  _20: LET SUM = 0;
  _30: LET DEPTH = 1;
  _40: INPUT "Enter a positive number: ", X;
  _50: IF X > 0 THEN GOTO _130;
  _60: PRINT "By positive, I mean greater than zero. You entered ", X, " which isn't";
  _70: GOTO _40;
  _80: SUM = SUM + X;
  _90: X = X - 1;
 _100: IF X > 0 THEN GOSUB _80;
 _110: DEPTH = DEPTH * 2;
 _120: RETURN;
 _130: GOSUB _80;
 _140: PRINT "SUM=", SUM, " DEPTH=", DEPTH;
}

不足之处:

  • 只支持数值类型变量

  • 要求 C++11 或者更新版本

  • 讨厌的分号

  • 变量必须在使用之前定义

  • 不能在核心模块中使用

  • 不支持很多语言特性,如 PRINT USING 和大多数 I/O

本文地址:https://www.codercto.com/soft/d/621.html

Think Python

Think Python

Allen B. Downey / O'Reilly Media / 2012-8-23 / GBP 29.99

Think Python is an introduction to Python programming for students with no programming experience. It starts with the most basic concepts of programming, and is carefully designed to define all terms ......一起来看看 《Think Python》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换