We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

CJProg

From Esolang
Jump to navigation Jump to search

CJProg is an Esolang invented by PSTF and his AI-friend Wenxinyiyan.

Syntax

Basic structure

Comment

  1. Use 注意: as Single Comment.
  2. Use 注意:[[[[ skrjhxsfksjrgngcyfsgf ]]]] as Multi Comment.

Variable

  1. Use 変数 to define a variable.
  2. There are ten usable types: 整数, 小数, 文字, 未定義(Void), 真偽値, 文字列, リスト(List), 辞書, 構造体, 対象.

I/O

  1. Use ユーザーからの入力 as user input to be a value.
  2. Use 出力 as output function.

Conditions

  1. "もし……そうしたら……然も無くば……終わり。" is "If……then……else……end.".

Loop

  1. "反復ループ (制御変数初期化ステートメント、条件付き判断ステートメント、インクリメンタル ステートメント)" is for(type var = init; condition; increase) in C++.
  2. Use 中断 to break a loop.
  3. "条件付きループ (条件式) {ステートメント}" is while(condition){statement} in C++.

Function

Function can be defined as this syntax(for example):

関数 整数型 主な過程()
{
    注意:主要関数にステートメントを書いてください!
    返す 0;
}

Class

This programming language actually emulates C++, so it is also an object-oriented programming language.

対象 円
{
    整数型 半径;
    
    作成(整数型 ぜ) 注意:この関数は、円型のオブジェクトを構築します。
    {
        半径 = ぜ;
    }
    
    小数型 面積(整数型 ぜ) 注意:この関数は、円の面積を計算するメンバー関数です。
    {
        返す ぜ * 円周率;
    }
    
    破棄(引数は必要ありません) 注意:これは、以前に作成された円を破壊するデストラクタです。
    {
        注意:リソースをクリーンアップする (存在する場合)
    }
}

関数 整数型 オブジェクトの使用()
{
    円 皿 = 円の作成(3);
    出力円の作成("この円の面積は", 皿.面積, "です。");
    円の破棄();注意:次に、このプレートを細かく砕きます。
    返す 0;
}

Example Programs

こんにちは、プログラミングの世界!

#徴兵する 《標準ライブラリ》

関数 整数型 主な過程()
{
    出力("Hello, world!");
    返す 0;
}

Cat program

#徴兵する 《標準ライブラリ》

関数 整数型 主な過程()
{
    文字列型 inputString;
    出力("Input a string: ");
    入力(inputString);
    出力("You inputted \"", inputString, "\".\n");
    返す 0;
}

See also

Categories