Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
|
|
@ -0,0 +1,14 @@
|
|||
PROGRAM-ID. increment-num-str.
|
||||
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
01 str PIC X(5) VALUE "12345".
|
||||
01 num REDEFINES str PIC 9(5).
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
DISPLAY str
|
||||
ADD 1 TO num
|
||||
DISPLAY str
|
||||
|
||||
GOBACK
|
||||
.
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
PROGRAM-ID. increment-num-str.
|
||||
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
01 num-str PIC 9(5) VALUE 12345.
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
DISPLAY num-str
|
||||
ADD 1 TO num-str
|
||||
DISPLAY num-str
|
||||
|
||||
GOBACK
|
||||
.
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
MODULE Operations;
|
||||
IMPORT StdLog,Args,Strings;
|
||||
|
||||
PROCEDURE IncString(s: ARRAY OF CHAR): LONGINT;
|
||||
VAR
|
||||
resp: LONGINT;
|
||||
done: INTEGER;
|
||||
BEGIN
|
||||
Strings.StringToLInt(s,resp,done);
|
||||
INC(resp);
|
||||
RETURN resp
|
||||
END IncString;
|
||||
|
||||
PROCEDURE DoIncString*;
|
||||
VAR
|
||||
p: Args.Params;
|
||||
BEGIN
|
||||
Args.Get(p);
|
||||
IF p.argc > 0 THEN
|
||||
StdLog.String(p.args[0] + " + 1= ");StdLog.Int(IncString(p.args[0]));StdLog.Ln
|
||||
END
|
||||
END DoIncString;
|
||||
|
||||
END Operations.
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import std.string;
|
||||
|
||||
void main() {
|
||||
string s = succ("12345");
|
||||
import std.string;
|
||||
|
||||
immutable s = "12349".succ;
|
||||
assert(s == "12350");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
put 0 into someVar
|
||||
add 1 to someVar
|
||||
-- without "into [field reference]" the value will appear
|
||||
-- in the message box
|
||||
put someVar -- into cd fld 1
|
||||
|
|
@ -0,0 +1 @@
|
|||
+(s::String, n::Integer) = string(int(s) + n)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
i=1
|
||||
i+=1
|
||||
Say i
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// rust 0.9-pre
|
||||
|
||||
fn main() {
|
||||
let s = "-1";
|
||||
let s = (from_str::<int>(s).unwrap() + 1).to_str();
|
||||
assert_eq!(s, ~"0");
|
||||
println(s);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue