优秀的编程知识分享平台

网站首页 > 技术文章 正文

代码教学(一)(代码视频教学新手)

nanyue 2024-07-20 00:00:30 技术文章 27 ℃

代码教学(一)

代码是一项非常重要的技能,仿真的学习一定离不开代码,一般较为高级的仿真都需要代码的加持,Flexsim仿真软件的代码是基于C++语言实现的,其基本要求与C++一样,今天小编就简单的介绍一下编程的基础问题。

Code is a very important skill. The learning of simulation must be inseparable from code. Generally, more advanced simulation requires the blessing of code. The code of Flexsim simulation software is implemented based on the C++ language, and its basic requirements are the same as C++. The editor will briefly introduce the basic issues of programming.

首先便为大家展示一下,编程的效果,其实我们运用的任何函数设置等可以直接选择的控制函数与对象都是与代码互相匹配的,就好比通过发生器设置一个实体颜色的操作功能函数,就对应着如下的代码函数。

First of all, I will show you the effect of programming. In fact, any function settings we use, such as control functions and objects that can be directly selected, are matched with the code. It is like setting a physical color operation function function through a generator. Corresponds to the following code function.

假如我们将发生器的离开触发设置成随机颜色,那么我们将会看见如下场景

If we set the leave trigger of the generator to a random color, then we will see the following scene

当我们点开其代码区域

When we click on its code area

将会看到关于随机颜色的代码

You will see the code for random colors

我们也可以通过下面的清除注释操作,获得起作用的函数语句

We can also use the following clear comment operation to get the function statement that works

其实代码是有很多基本规则的,跟C++语言规则一样,我就不赘述了,接下来为大家介绍一下如何编写代码,一般尽量在重置触发里面对于实体进行代码编写

In fact, there are many basic rules for code, which are the same as the C++ language rules, so I won’t go into details. Next, I will introduce how to write code. Generally, try to code entities in the reset trigger.

然后我们选用最常见的操作,输出hello world!

Then we choose the most common operation and output hello world!

接下来我们在调试中找到输出控制台

Next we find the output console in debugging

当我们单击重置的时候,便会在输出控制台上输出我们编写的内容

When we click reset, the content we wrote will be output on the output console

仿真编码的时候是不会识别空格,换行符,水平制表符所以格式的要求是不太高的,但是为了编程的美观和可读性,自己可以尽量让它好看一些。

When emulating coding, spaces, line breaks, and horizontal tabs are not recognized, so the format requirements are not too high, but for the beauty and readability of programming, you can make it look better.

最后为大家介绍一下块注释,块注释的特点在于,可以进行换行,可以一大块的注释,具体表现如下

Finally, I will introduce you to the block comment. The characteristic of the block comment is that it can be wrapped and can be a large block of comments. The specific performance is as follows

参考资料:腾讯课堂《从小白到大神》

英文翻译:Google翻译

本文由LearningYard学苑原创,若有侵权请联系删除!

Tags:

最近发表
标签列表