问题描述
我有一个包含以下文字的文字文件。
我需要编写一个c ++程序,将以下文本转换为可以运行的c ++代码。谁能告诉我怎么做到这个?
文字如下:
节目aba13;
VAR
ab5,cb,be,eb:整数;
BEGIN
ab5 = 5;
cb = 10;
打印(ab5 =,ab5);
eb = cb + ab5;
PRINT(eb);
be = 2 * ab5 + eb;
PRINT(be =,be);
END。
I have a text file which contains following text.
I need to write a c++ program which converts following text into c++ code which can be run. Can anyone tell me how I can achieve this?
Text is as follows:
Program aba13;
VAR
ab5,cb,be,eb:integer;
BEGIN
ab5=5;
cb=10;
Print("ab5=",ab5);
eb=cb+ab5;
PRINT(eb);
be=2*ab5+eb;
PRINT("be=",be);
END.
推荐答案
void main()
{
cout << "ab5=5" << endl;
cout << "15" << endl;
cout << "eb=25" << endl;
}
它产生与源程序相同的输出。不幸的是,它无法做任何事情: - )
It produces the same output as your source program. Unfortunately, it can't do anything else :-)
这篇关于用于从文本生成c ++代码的C ++程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!