二、在西門子1200PLC中用SCL排序
1、在1200PLC中,Sort an array of indeterminate length,For variable-length array data types can only be built inInOut引腳上
2、Create a new one of any numberArrayA variable of type integer data type,運行後的結果
三、總結
1、The two ideas are the same.Both exchange positions by cyclic comparison,Push data features to the end,It can also be the first.
2、在具體實現上,python用While循環,用的len()method to get the number of loop rounds and the number of comparisons;scl用FOR循環,用LOWER_BOUND()和UPPER_BOUND()to determine the lower and upper bounds of the comparison array,Then select the first one in the outer loop and compare them one by one in the inner loop.
四、擴展:sclUse existing functions to find the maximum and minimum values in an array
1、對定長ArrayFind the maximum and minimum values,可以直接用FC功能塊
2、運行結果
3、改進,to indefinite lengthArrayFind the maximum and minimum values
4、修改後的scl,用了Static管腳的Upper上限,所以用的FB功能塊.
5、運行結果
unixenvironment in advanced programmingerr_quit,err_sys 環境 os CentOS release 6.7 (Final) gcc 4.4.7 c語言預備知識 標准輸入輸出文件 在linuxeverything in the system ...
# gives a list of pure numbers. Please sort the list. # 思路: # 1.完成a和b的數據交換. 例如, a = 10, b = 24 交換之後, a = 24, b = 10 # 2.循環列表. 判斷a[i ...
1.PythonBindings of properties and methods in 正常情況下,當我們定義了一個class,創建了一個class的實例後,我們可以給該實例綁定任何屬性和方法. (1)首先,定義一個class: class Stu ...
__slots__特殊變量的使用: 由於Python是動態語言,允許先編寫類,然後在創建實例的時候添加屬性或者方法:而__slots__特殊變量就是,限制往類裡添加屬性的: 在創建類的時候,使用__s ...
Reference is from Liao XuefengPython教程:https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/ ...
第一種:// 聲明一個全局對象Namespace,用來注冊命名空間Namespace = new Object();// 全局對象僅僅存在register函數,參數為名稱空間全路徑,如"Gr ...
今天學習了下scala中的鏈式調用風格的實現,在spark編程中,我們經常會看到如下一段代碼: sc.textFile("hdfs://......").flatMap(_.spl ...
第一種寫法(前冒泡): /* C程序數組算法 - 冒泡法排序 * 此例子按照 大 -> 小 排序 * 原理:兩兩相比較,然後進行大小對調 * 比較次數: n^2 次 * 說明:冒泡排序是相對穩定 ...
def sequence(disorder='', separators=''): arrays = disorder.split(separators) def desc(): for i in r ...
想寫一個冒泡法排序,沒什麼思路,就先寫了個java的 public static void main(String[] args) { int array[] = {88,2,43,12,34,8,6 ...
其實有個方法最簡單,就是點擊“幫助”,選擇注冊產品,點擊打開頁面右下邊的“使用秘鑰注冊產品”,輸入上述秘鑰即可. 在輸入密鑰界面,輸入密鑰“BWG7X-J98B3-W34RT-33B3R-JVYW ...
代碼: #include<cstdio> #include<cstring> #define N 200000 using namespace std; long long f ...
New blog address http://lizhug.com
湖南省第十二屆大學生計算機程序設計競賽$H$題 規律,遞推. There are rules to this question.Contributions to the answer can be counted bit by bit.即第$1$How much the bit contributed to the answer,第$2$How much the bit contributed to the answer.....The cumulative sum is the answer. ...
Needed for recent paperspython做數據分析,python語法簡單,但是WindowsInstalling third-party packages is disgusting,statsmodels用pip死活安裝不上,I checked online that the packages are interdependentwindows下的pip不能下 ...
soureTree For mac 破解版下載地址:鏈接: https://pan.baidu.com/s/1c19kFRi 密碼: ai7f
gltf 為 y 軸向上的右手坐標系 3d-tiles 為 z 軸向上的右手坐標系
方法一 DELETE FROM A WHERE `name` in ( SELECT a.name FROM( SELECT name FROM A a GROUP BY name HAVING CO ...
簡介 Condition中的await()方法相當於Object的wait()方法,Condition中的signal()方法相當於Object的notify()方法,Condition中的signa ...
1. rand(d0,d1,.....,dn)產生[0,1]的浮點隨機數,Parameters inside parentheses can specify the shape of the resulting array 例如:np.random.rand(3,2)則產生 3×2的數組,裡面的數是0-1 ...