The*_* do 5 c# c++ java math documentation
有没有人记录过具有前后条件的函数或方法?(我问,因为我的老师说这是正式/正确的方式):
传说:(因为我无法输入特殊字符)3 - 将其读作"存在"和"存在"
E - 是(如在集合中)的成员
A - 对于所有
- > - 暗示
假设s是非空字符串.设B(s)是给出字符串s中位置索引的整数集.
这里开始记录这个函数:
int FirstOccurence(String s, Char c)
precondition:
(s.lenght() > 0) && 3 int i in B(s) [s.charAt(i) == c]
Run Code Online (Sandbox Code Playgroud)
那是等待后置条件的前提条件;)
postcondition:
(FirstOccurence(s,c) E B(s)) && (s.charAt(FirstOccurence(s,c)) == c) &&
A int i B(s)[(i < FirstOccurence(s,c)) --> !(s.charAt(i) == c) ]
Run Code Online (Sandbox Code Playgroud)
你们中的任何一个人是否曾经遇到过在现实世界中记录功能/方法的方式?