在 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

Struts 2 in Action

Struts 2 in Action

Don Brown、Chad Davis、Scott Stanlick / Manning Publications / 2008.3 / $44.99

The original Struts project revolutionized Java web development and its rapid adoption resulted in the thousands of Struts-based applications deployed worldwide. Keeping pace with new ideas and trends......一起来看看 《Struts 2 in Action》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具