Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
58
Task/The-Name-Game/COBOL/the-name-game.cobol
Normal file
58
Task/The-Name-Game/COBOL/the-name-game.cobol
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. TheGameName.
|
||||
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
01 nombre PIC X(20).
|
||||
01 x PIC X(20).
|
||||
01 x0 PIC X(1).
|
||||
01 y PIC X(20).
|
||||
01 b PIC X(20).
|
||||
01 f PIC X(20).
|
||||
01 m PIC X(20).
|
||||
01 i PIC 9(2) VALUE 1.
|
||||
01 listanombres OCCURS 6 TIMES PIC X(20).
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
MAIN-PROCEDURE.
|
||||
MOVE "Gary" TO listanombres(1)
|
||||
MOVE "EARL" TO listanombres(2)
|
||||
MOVE "billy" TO listanombres(3)
|
||||
MOVE "FeLiX" TO listanombres(4)
|
||||
MOVE "Mary" TO listanombres(5)
|
||||
MOVE "ShirlEY" TO listanombres(6)
|
||||
|
||||
PERFORM VARYING i FROM 1 BY 1 UNTIL i > 6
|
||||
MOVE listanombres(i) TO nombre
|
||||
PERFORM TheGameName
|
||||
END-PERFORM
|
||||
STOP RUN.
|
||||
|
||||
TheGameName.
|
||||
MOVE FUNCTION LOWER-CASE(nombre) TO x
|
||||
MOVE FUNCTION UPPER-CASE(x(1:1)) TO x0
|
||||
STRING x0 DELIMITED BY SIZE
|
||||
x(2:) DELIMITED BY SIZE INTO x
|
||||
|
||||
IF x0 = "A" OR x0 = "E" OR x0 = "I" OR x0 = "O" OR x0 = "U"
|
||||
MOVE FUNCTION LOWER-CASE(x) TO y
|
||||
ELSE
|
||||
MOVE x(2:) TO y
|
||||
END-IF
|
||||
|
||||
STRING "b" y DELIMITED BY SIZE INTO b
|
||||
STRING "f" y DELIMITED BY SIZE INTO f
|
||||
STRING "m" y DELIMITED BY SIZE INTO m
|
||||
|
||||
IF x0 = "B"
|
||||
MOVE y TO b
|
||||
ELSE IF x0 = "F"
|
||||
MOVE y TO f
|
||||
ELSE IF x0 = "M"
|
||||
MOVE y TO m
|
||||
END-IF
|
||||
|
||||
DISPLAY x ", " x ", bo-" b
|
||||
DISPLAY "Banana-fana fo-" f
|
||||
DISPLAY "Fee-fi-mo-" m
|
||||
DISPLAY x "!".
|
||||
39
Task/The-Name-Game/Chipmunk-Basic/the-name-game.basic
Normal file
39
Task/The-Name-Game/Chipmunk-Basic/the-name-game.basic
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
100 sub thegamename(nombre$)
|
||||
110 x$ = lcase$(nombre$)
|
||||
120 x$ = ucase$(mid$(x$,1,1))+mid$(x$,2,len(x$)-1)
|
||||
130 x0$ = ucase$(mid$(x$,1,1))
|
||||
140 if x0$ = "A" or x0$ = "E" or x0$ = "I" or x0$ = "O" or x0$ = "U" then
|
||||
150 y$ = lcase$(x$)
|
||||
160 else
|
||||
170 y$ = mid$(x$,2)
|
||||
180 endif
|
||||
190 b$ = "b"+y$
|
||||
200 f$ = "f"+y$
|
||||
210 m$ = "m"+y$
|
||||
220 if x0$ = "B" then
|
||||
230 b$ = y$
|
||||
240 else
|
||||
245 if x0$ = "F" then
|
||||
250 f$ = y$
|
||||
260 else
|
||||
265 if x0$ = "M" then
|
||||
270 m$ = y$
|
||||
275 endif
|
||||
276 endif
|
||||
280 endif
|
||||
290 print x$+", "+x$+", bo-"+b$
|
||||
300 print "Banana-fana fo-"+f$
|
||||
310 print "Fee-fi-mo-"+m$
|
||||
320 print x$+"!"+chr$(10)
|
||||
330 end sub
|
||||
340 dim listanombres$(5)
|
||||
350 listanombres$(0) = "Gary"
|
||||
360 listanombres$(1) = "EARL"
|
||||
370 listanombres$(2) = "billy"
|
||||
380 listanombres$(3) = "FeLiX"
|
||||
390 listanombres$(4) = "Mary"
|
||||
400 listanombres$(5) = "ShirlEY"
|
||||
410 for i = 0 to ubound(listanombres$)
|
||||
420 thegamename(listanombres$(i))
|
||||
430 next i
|
||||
440 end
|
||||
40
Task/The-Name-Game/Dart/the-name-game.dart
Normal file
40
Task/The-Name-Game/Dart/the-name-game.dart
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
void theGameName(String nombre) {
|
||||
String x = nombre.toLowerCase();
|
||||
x = x[0].toUpperCase() + x.substring(1);
|
||||
String x0 = x[0].toUpperCase();
|
||||
|
||||
String y;
|
||||
if (x0 == 'A' || x0 == 'E' || x0 == 'I' || x0 == 'O' || x0 == 'U') {
|
||||
y = x.toLowerCase();
|
||||
} else {
|
||||
y = x.substring(1);
|
||||
}
|
||||
|
||||
String b = 'b' + y;
|
||||
String f = 'f' + y;
|
||||
String m = 'm' + y;
|
||||
|
||||
switch (x0) {
|
||||
case 'B':
|
||||
b = y;
|
||||
break;
|
||||
case 'F':
|
||||
f = y;
|
||||
break;
|
||||
case 'M':
|
||||
m = y;
|
||||
break;
|
||||
}
|
||||
|
||||
print('$x, $x, bo-$b');
|
||||
print('Banana-fana fo-$f');
|
||||
print('Fee-fi-mo-$m');
|
||||
print('$x!\n');
|
||||
}
|
||||
|
||||
void main() {
|
||||
List<String> listanombres = ['Gary', 'Earl', 'Billy', 'Felix', 'Mary', 'Steve'];
|
||||
for (String nombre in listanombres) {
|
||||
theGameName(nombre);
|
||||
}
|
||||
}
|
||||
38
Task/The-Name-Game/Gambas/the-name-game.gambas
Normal file
38
Task/The-Name-Game/Gambas/the-name-game.gambas
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
Public Sub TheGameName(nombre As String)
|
||||
|
||||
Dim x As String = LCase(nombre)
|
||||
x = UCase(Mid(x, 1, 1)) & Mid(x, 2, Len(x) - 1)
|
||||
Dim x0 As String = UCase(Mid(x, 1, 1))
|
||||
|
||||
Dim y As String
|
||||
y = IIf((x0 = "A" Or x0 = "E" Or x0 = "I" Or x0 = "O" Or x0 = "U"), LCase(x), Mid(x, 2))
|
||||
|
||||
Dim b As String = "b" & y
|
||||
Dim f As String = "f" & y
|
||||
Dim m As String = "m" & y
|
||||
|
||||
Select Case x0
|
||||
Case "B"
|
||||
b = y
|
||||
Case "F"
|
||||
f = y
|
||||
Case "M"
|
||||
m = y
|
||||
End Select
|
||||
|
||||
Print x & ", " & x & ", bo-" & b
|
||||
Print "Banana-fana fo-" & f
|
||||
Print "Fee-fi-mo-" & m
|
||||
Print x & "!" & Chr(10)
|
||||
|
||||
End Sub
|
||||
|
||||
Public Sub Main()
|
||||
|
||||
Dim listanombres As String[] = ["Gary", "EARL", "billy", "FeLiX", "Mary", "ShirlEY"]
|
||||
|
||||
For Each nombre As String In listanombres
|
||||
TheGameName(nombre)
|
||||
Next
|
||||
|
||||
End
|
||||
41
Task/The-Name-Game/PureBasic/the-name-game.basic
Normal file
41
Task/The-Name-Game/PureBasic/the-name-game.basic
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
OpenConsole()
|
||||
Procedure TheGameName(nombre.s)
|
||||
x.s = LCase(nombre)
|
||||
x = UCase(Mid(x, 1, 1)) + Mid(x, 2, Len(x) - 1)
|
||||
x0.s = UCase(Mid(x, 1, 1))
|
||||
|
||||
If x0 = "A" Or x0 = "E" Or x0 = "I" Or x0 = "O" Or x0 = "U"
|
||||
y.s = LCase(x)
|
||||
Else
|
||||
y.s = Mid(x, 2, Len(x) - 1)
|
||||
EndIf
|
||||
|
||||
b.s = "b" + y
|
||||
f.s = "f" + y
|
||||
m.s = "m" + y
|
||||
|
||||
Select x0
|
||||
Case "B"
|
||||
b = y
|
||||
Case "F"
|
||||
f = y
|
||||
Case "M"
|
||||
m = y
|
||||
EndSelect
|
||||
|
||||
PrintN(x + ", " + x + ", bo-" + b + #CRLF$ + "Banana-fana fo-" + f + #CRLF$ + "Fee-fi-mo-" + m + #CRLF$ + x + "!" + #CRLF$)
|
||||
EndProcedure
|
||||
|
||||
Dim listanombres.s(5)
|
||||
listanombres(0) = "Gary"
|
||||
listanombres(1) = "EARL"
|
||||
listanombres(2) = "billy"
|
||||
listanombres(3) = "FeLiX"
|
||||
listanombres(4) = "Mary"
|
||||
listanombres(5) = "ShirlEY"
|
||||
|
||||
For i = 0 To 5
|
||||
TheGameName(listanombres(i))
|
||||
Next i
|
||||
Input()
|
||||
CloseConsole()
|
||||
48
Task/The-Name-Game/QBasic/the-name-game.basic
Normal file
48
Task/The-Name-Game/QBasic/the-name-game.basic
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
DECLARE SUB TheGameName (nombre AS STRING)
|
||||
|
||||
DIM listanombres(5) AS STRING
|
||||
listanombres(0) = "Gary"
|
||||
listanombres(1) = "EARL"
|
||||
listanombres(2) = "billy"
|
||||
listanombres(3) = "FeLiX"
|
||||
listanombres(4) = "Mary"
|
||||
listanombres(5) = "ShirlEY"
|
||||
|
||||
FOR i = 0 TO UBOUND(listanombres)
|
||||
TheGameName (listanombres(i))
|
||||
NEXT i
|
||||
|
||||
SUB TheGameName (nombre AS STRING)
|
||||
DIM x AS STRING
|
||||
x = LCASE$(nombre)
|
||||
x = UCASE$(MID$(x, 1, 1)) + (MID$(x, 2, LEN(x) - 1))
|
||||
DIM x0 AS STRING
|
||||
x0 = UCASE$(MID$(x, 1, 1))
|
||||
|
||||
DIM y AS STRING
|
||||
IF x0 = "A" OR x0 = "E" OR x0 = "I" OR x0 = "O" OR x0 = "U" THEN
|
||||
y = LCASE$(x)
|
||||
ELSE
|
||||
y = MID$(x, 2)
|
||||
END IF
|
||||
|
||||
DIM b AS STRING
|
||||
b = "b" + y
|
||||
DIM f AS STRING
|
||||
f = "f" + y
|
||||
DIM m AS STRING
|
||||
m = "m" + y
|
||||
|
||||
IF x0 = "B" THEN
|
||||
b = y
|
||||
ELSEIF x0 = "F" THEN
|
||||
f = y
|
||||
ELSEIF x0 = "M" THEN
|
||||
m = y
|
||||
END IF
|
||||
|
||||
PRINT x + ", " + x + ", bo-" + b
|
||||
PRINT "Banana-fana fo-" + f
|
||||
PRINT "Fee-fi-mo-" + m
|
||||
PRINT x + "!" + CHR$(10)
|
||||
END SUB
|
||||
36
Task/The-Name-Game/Run-BASIC/the-name-game.basic
Normal file
36
Task/The-Name-Game/Run-BASIC/the-name-game.basic
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
dim listanombres$(5)
|
||||
|
||||
for i = 0 to 5
|
||||
read listanombres$
|
||||
call TheGameName listanombres$
|
||||
next i
|
||||
data "Gary", "EARL", "billy", "FeLiX", "Mary", "ShirleY"
|
||||
end
|
||||
|
||||
sub TheGameName nombre$
|
||||
x$ = lower$(nombre$)
|
||||
x$ = upper$(mid$(x$, 1, 1)) + mid$(x$, 2, len(x$) - 1)
|
||||
x0$ = upper$(mid$(x$, 1, 1))
|
||||
|
||||
if x0$ = "A" or x0$ = "E" or x0$ = "I" or x0$ = "O" or x0$ = "U" then
|
||||
y$ = lower$(x$)
|
||||
else
|
||||
y$ = mid$(x$, 2)
|
||||
end if
|
||||
|
||||
b$ = "b" + y$
|
||||
f$ = "f" + y$
|
||||
m$ = "m" + y$
|
||||
|
||||
select case x0$
|
||||
case "B" : b$ = y$
|
||||
case "F" : f$ = y$
|
||||
case "M" : m$ = y$
|
||||
end select
|
||||
|
||||
print x$ + ", " + x$ + ", bo-" + b$
|
||||
print "Banana-fana fo-" + f$
|
||||
print "Fee-fi-mo-" + m$
|
||||
print x$ + "!"
|
||||
print
|
||||
end sub
|
||||
20
Task/The-Name-Game/Rust/the-name-game.rs
Normal file
20
Task/The-Name-Game/Rust/the-name-game.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
fn verse(name: &str) -> String {
|
||||
let lower_name = name.to_lowercase();
|
||||
let mut x = lower_name.clone();
|
||||
x.replace_range(0..1, x[0..1].to_uppercase().as_str());
|
||||
let y = if "AEIOU".contains(&x[0..=0]) {lower_name.as_str()} else {&x[1..]};
|
||||
let b = if &x[0..1] == "B" {""} else {"b"};
|
||||
let f = if &x[0..1] == "F" {""} else {"f"};
|
||||
let m = if &x[0..1] == "M"{""} else {"m"};
|
||||
return format!(r#"
|
||||
{x}, {x}, bo-{b}{y}
|
||||
Banana-fana fo-{f}{y}
|
||||
Fee-fi-mo-{m}{y}
|
||||
{x}!"#);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
for name in ["gARY", "Earl", "Billy", "Felix", "Mary", "sHIRley"] {
|
||||
println!("{}", verse(name));
|
||||
}
|
||||
}
|
||||
44
Task/The-Name-Game/True-BASIC/the-name-game.basic
Normal file
44
Task/The-Name-Game/True-BASIC/the-name-game.basic
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
OPTION BASE 0
|
||||
|
||||
SUB thegamename (nombre$)
|
||||
LET x$ = LCASE$(nombre$)
|
||||
LET x$ = UCASE$((x$)[1:1+1-1]) & ((x$)[2:2+LEN(x$)-1-1])
|
||||
LET x0$ = UCASE$((x$)[1:1+1-1])
|
||||
|
||||
IF x0$ = "A" OR x0$ = "E" OR x0$ = "I" OR x0$ = "O" OR x0$ = "U" THEN
|
||||
LET y$ = LCASE$(x$)
|
||||
ELSE
|
||||
LET y$ = (x$)[2:maxnum]
|
||||
END IF
|
||||
|
||||
LET b$ = "b" & y$
|
||||
LET f$ = "f" & y$
|
||||
LET m$ = "m" & y$
|
||||
|
||||
IF x0$ = "B" THEN
|
||||
LET b$ = y$
|
||||
ELSEIF x0$ = "F" THEN
|
||||
LET f$ = y$
|
||||
ELSEIF x0$ = "M" THEN
|
||||
LET m$ = y$
|
||||
END IF
|
||||
|
||||
PRINT x$ & ", " & x$ & ", bo-" & b$
|
||||
PRINT "Banana-fana fo-" & f$
|
||||
PRINT "Fee-fi-mo-" & m$
|
||||
PRINT x$ & "!"
|
||||
PRINT
|
||||
END SUB
|
||||
|
||||
DIM listanombres$(5)
|
||||
LET listanombres$(0) = "Gary"
|
||||
LET listanombres$(1) = "EARL"
|
||||
LET listanombres$(2) = "billy"
|
||||
LET listanombres$(3) = "FeLiX"
|
||||
LET listanombres$(4) = "Mary"
|
||||
LET listanombres$(5) = "ShirlEY"
|
||||
|
||||
FOR i = 0 TO UBOUND(listanombres$)
|
||||
CALL thegamename(listanombres$(i))
|
||||
NEXT i
|
||||
END
|
||||
|
|
@ -1,24 +1,24 @@
|
|||
fn main() {
|
||||
list := ['Gary', 'Earl', 'Billy', 'Felix', 'Mary']
|
||||
list := ["Gary", "Earl", "Billy", "Felix", "Mary"]
|
||||
for name in list {verse(name)}
|
||||
}
|
||||
|
||||
fn verse(name string) {
|
||||
mut b, mut f, mut m, mut y :='','','',''
|
||||
mut b, mut f, mut m, mut y :="","","",""
|
||||
mut x := name.to_lower().title()
|
||||
y = x.substr(1, x.len)
|
||||
if 'AEIOU'.contains(x[0].ascii_str()) {y = x.to_lower()}
|
||||
b = 'b' + y
|
||||
f = 'f' + y
|
||||
m = 'm' + y
|
||||
if "AEIOU".contains(x[0].ascii_str()) {y = x.to_lower()}
|
||||
b = "b" + y
|
||||
f = "f" + y
|
||||
m = "m" + y
|
||||
match x[0].ascii_str() {
|
||||
'B' {b = y}
|
||||
'F' {f = y}
|
||||
'M' {m = y}
|
||||
"B" {b = y}
|
||||
"F" {f = y}
|
||||
"M" {m = y}
|
||||
else {}
|
||||
}
|
||||
println('$x, $x, bo-$b')
|
||||
println('Banana-fana fo-$f')
|
||||
println('Fee-fi-mo-$m')
|
||||
println('$x!\n')
|
||||
println("${x}, ${x}, bo-${b}")
|
||||
println("Banana-fana fo-${f}")
|
||||
println("Fee-fi-mo-${m}")
|
||||
println("${x}!\n")
|
||||
}
|
||||
|
|
|
|||
53
Task/The-Name-Game/XBasic/the-name-game.basic
Normal file
53
Task/The-Name-Game/XBasic/the-name-game.basic
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
PROGRAM "The Name Game"
|
||||
VERSION "0.0000"
|
||||
|
||||
DECLARE FUNCTION Entry ()
|
||||
DECLARE FUNCTION TheGameName (nombre$)
|
||||
|
||||
FUNCTION Entry ()
|
||||
DIM listanombres$[5]
|
||||
listanombres$[0] = "Gary"
|
||||
listanombres$[1] = "EARL"
|
||||
listanombres$[2] = "billy"
|
||||
listanombres$[3] = "FeLiX"
|
||||
listanombres$[4] = "Mary"
|
||||
listanombres$[5] = "ShirlEY"
|
||||
|
||||
FOR i = 0 TO 5
|
||||
TheGameName(listanombres$[i])
|
||||
NEXT i
|
||||
END FUNCTION
|
||||
|
||||
FUNCTION TheGameName (nombre$)
|
||||
x$ = LCASE$(nombre$)
|
||||
x$ = UCASE$(MID$(x$, 1, 1)) + MID$(x$, 2, LEN(x$) - 1)
|
||||
x0$ = UCASE$(MID$(x$, 1, 1))
|
||||
|
||||
IF (x0$ = "A") OR (x0$ = "E") OR (x0$ = "I") OR (x0$ = "O") OR (x0$ = "U") THEN
|
||||
y$ = LCASE$(x$)
|
||||
ELSE
|
||||
y$ = MID$(x$, 2, LEN(x$) - 1)
|
||||
END IF
|
||||
|
||||
b$ = "b" + y$
|
||||
f$ = "f" + y$
|
||||
m$ = "m" + y$
|
||||
|
||||
IF x0$ = "B" THEN
|
||||
b$ = y$
|
||||
ELSE
|
||||
IF x0$ = "F" THEN
|
||||
f$ = y$
|
||||
ELSE
|
||||
IF x0$ = "M" THEN
|
||||
m$ = y$
|
||||
END IF
|
||||
END IF
|
||||
END IF
|
||||
|
||||
PRINT x$ + ", " + x$ + ", bo-" + b$
|
||||
PRINT "Banana-fana fo-" + f$
|
||||
PRINT "Fee-fi-mo-" + m$
|
||||
PRINT x$ + "!" + CHR$(10)
|
||||
END FUNCTION
|
||||
END PROGRAM
|
||||
40
Task/The-Name-Game/Yabasic/the-name-game.basic
Normal file
40
Task/The-Name-Game/Yabasic/the-name-game.basic
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
dim listanombres$(5)
|
||||
listanombres$(0) = "Gary"
|
||||
listanombres$(1) = "EARL"
|
||||
listanombres$(2) = "billy"
|
||||
listanombres$(3) = "FeLiX"
|
||||
listanombres$(4) = "Mary"
|
||||
listanombres$(5) = "ShirlEY"
|
||||
|
||||
for i = 0 to arraysize(listanombres$(), 1)
|
||||
TheGameName(listanombres$(i))
|
||||
next i
|
||||
end
|
||||
|
||||
sub TheGameName(nombre$)
|
||||
local x$, x0$, y$, b$, f$, m$
|
||||
x$ = lower$(nombre$)
|
||||
x$ = upper$(mid$(x$, 1, 1)) + mid$(x$, 2, len(x$) - 1)
|
||||
x0$ = upper$(mid$(x$, 1, 1))
|
||||
|
||||
if x0$ = "A" or x0$ = "E" or x0$ = "I" or x0$ = "O" or x0$ = "U" then
|
||||
y$ = lower$(x$)
|
||||
else
|
||||
y$ = mid$(x$, 2)
|
||||
end if
|
||||
|
||||
b$ = "b" + y$
|
||||
f$ = "f" + y$
|
||||
m$ = "m" + y$
|
||||
|
||||
switch x0$
|
||||
case "B" : b$ = y$
|
||||
case "F" : f$ = y$
|
||||
case "M" : m$ = y$
|
||||
end switch
|
||||
|
||||
print x$ + ", " + x$ + ", bo-" + b$
|
||||
print "Banana-fana fo-" + f$
|
||||
print "Fee-fi-mo-" + m$
|
||||
print x$ + "!" + chr$(10)
|
||||
end sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue