Instruction stringlengths 45 106 | input_code stringlengths 1 13.7k | output_code stringlengths 1 13.7k |
|---|---|---|
Rewrite the snippet below in Java so it works the same as the original Icon code. | procedure main ()
writes ("Enter something: ")
s := read ()
write ("You entered: " || s)
writes ("Enter 75000: ")
if (i := integer (read ())) then
write (if (i = 75000) then "correct" else "incorrect")
else write ("you must enter a number")
end
| import java.util.Scanner;
public class GetInput {
public static void main(String[] args) throws Exception {
Scanner s = new Scanner(System.in);
System.out.print("Enter a string: ");
String str = s.nextLine();
System.out.print("Enter an integer: ");
int i = Integer.parseInt(s... |
Maintain the same structure and functionality when rewriting this code in Python. | procedure main ()
writes ("Enter something: ")
s := read ()
write ("You entered: " || s)
writes ("Enter 75000: ")
if (i := integer (read ())) then
write (if (i = 75000) then "correct" else "incorrect")
else write ("you must enter a number")
end
| string = raw_input("Input a string: ")
|
Transform the following Icon implementation into VB, maintaining the same output and logic. | procedure main ()
writes ("Enter something: ")
s := read ()
write ("You entered: " || s)
writes ("Enter 75000: ")
if (i := integer (read ())) then
write (if (i = 75000) then "correct" else "incorrect")
else write ("you must enter a number")
end
| Public Sub text()
Debug.Print InputBox("Input a string")
Debug.Print InputBox("Input the integer 75000", "Input an integer", 75000, Context = "Long")
End Sub
|
Translate this program into Go but keep the logic exactly as in Icon. | procedure main ()
writes ("Enter something: ")
s := read ()
write ("You entered: " || s)
writes ("Enter 75000: ")
if (i := integer (read ())) then
write (if (i = 75000) then "correct" else "incorrect")
else write ("you must enter a number")
end
| package main
import "fmt"
func main() {
var s string
var i int
if _, err := fmt.Scan(&s, &i); err == nil && i == 75000 {
fmt.Println("good")
} else {
fmt.Println("wrong")
}
}
|
Convert the following code from J to C, ensuring the logic remains intact. | require 'misc'
prompt 'Enter string: '
0".prompt 'Enter an integer: '
| #include <stdio.h>
#include <stdlib.h>
int main(void)
{
char str[BUFSIZ];
puts("Enter a string: ");
fgets(str, sizeof(str), stdin);
long num;
char buf[BUFSIZ];
do
{
puts("Enter 75000: ");
fgets(buf, sizeof(buf), stdin);
num = strtol(buf, NULL, 10);
} w... |
Can you help me rewrite this code in C# instead of J, keeping it the same logically? | require 'misc'
prompt 'Enter string: '
0".prompt 'Enter an integer: '
| using System;
namespace C_Sharp_Console {
class example {
static void Main() {
string word;
int num;
Console.Write("Enter an integer: ");
num = Console.Read();
Console.Write("Enter a String: ");
word = Console.ReadLine()... |
Can you help me rewrite this code in C++ instead of J, keeping it the same logically? | require 'misc'
prompt 'Enter string: '
0".prompt 'Enter an integer: '
| #include <iostream>
#include <string>
using namespace std;
int main()
{
long int integer_input;
string string_input;
cout << "Enter an integer: ";
cin >> integer_input;
cout << "Enter a string: ";
cin >> string_input;
return 0;
}
|
Produce a language-to-language conversion: from J to Java, same semantics. | require 'misc'
prompt 'Enter string: '
0".prompt 'Enter an integer: '
| import java.util.Scanner;
public class GetInput {
public static void main(String[] args) throws Exception {
Scanner s = new Scanner(System.in);
System.out.print("Enter a string: ");
String str = s.nextLine();
System.out.print("Enter an integer: ");
int i = Integer.parseInt(s... |
Rewrite the snippet below in Python so it works the same as the original J code. | require 'misc'
prompt 'Enter string: '
0".prompt 'Enter an integer: '
| string = raw_input("Input a string: ")
|
Write the same algorithm in VB as shown in this J implementation. | require 'misc'
prompt 'Enter string: '
0".prompt 'Enter an integer: '
| Public Sub text()
Debug.Print InputBox("Input a string")
Debug.Print InputBox("Input the integer 75000", "Input an integer", 75000, Context = "Long")
End Sub
|
Port the provided J code into Go while preserving the original functionality. | require 'misc'
prompt 'Enter string: '
0".prompt 'Enter an integer: '
| package main
import "fmt"
func main() {
var s string
var i int
if _, err := fmt.Scan(&s, &i); err == nil && i == 75000 {
fmt.Println("good")
} else {
fmt.Println("wrong")
}
}
|
Preserve the algorithm and functionality while converting the code from Julia to C. | print("String? ")
y = readline()
println("Your input was \"", y, "\".\n")
print("Integer? ")
y = readline()
try
y = parse(Int, y)
println("Your input was \"", y, "\".\n")
catch
println("Sorry, but \"", y, "\" does not compute as an integer.")
end
| #include <stdio.h>
#include <stdlib.h>
int main(void)
{
char str[BUFSIZ];
puts("Enter a string: ");
fgets(str, sizeof(str), stdin);
long num;
char buf[BUFSIZ];
do
{
puts("Enter 75000: ");
fgets(buf, sizeof(buf), stdin);
num = strtol(buf, NULL, 10);
} w... |
Convert this Julia block to C#, preserving its control flow and logic. | print("String? ")
y = readline()
println("Your input was \"", y, "\".\n")
print("Integer? ")
y = readline()
try
y = parse(Int, y)
println("Your input was \"", y, "\".\n")
catch
println("Sorry, but \"", y, "\" does not compute as an integer.")
end
| using System;
namespace C_Sharp_Console {
class example {
static void Main() {
string word;
int num;
Console.Write("Enter an integer: ");
num = Console.Read();
Console.Write("Enter a String: ");
word = Console.ReadLine()... |
Convert this Julia block to C++, preserving its control flow and logic. | print("String? ")
y = readline()
println("Your input was \"", y, "\".\n")
print("Integer? ")
y = readline()
try
y = parse(Int, y)
println("Your input was \"", y, "\".\n")
catch
println("Sorry, but \"", y, "\" does not compute as an integer.")
end
| #include <iostream>
#include <string>
using namespace std;
int main()
{
long int integer_input;
string string_input;
cout << "Enter an integer: ";
cin >> integer_input;
cout << "Enter a string: ";
cin >> string_input;
return 0;
}
|
Write the same code in Java as shown below in Julia. | print("String? ")
y = readline()
println("Your input was \"", y, "\".\n")
print("Integer? ")
y = readline()
try
y = parse(Int, y)
println("Your input was \"", y, "\".\n")
catch
println("Sorry, but \"", y, "\" does not compute as an integer.")
end
| import java.util.Scanner;
public class GetInput {
public static void main(String[] args) throws Exception {
Scanner s = new Scanner(System.in);
System.out.print("Enter a string: ");
String str = s.nextLine();
System.out.print("Enter an integer: ");
int i = Integer.parseInt(s... |
Generate an equivalent Python version of this Julia code. | print("String? ")
y = readline()
println("Your input was \"", y, "\".\n")
print("Integer? ")
y = readline()
try
y = parse(Int, y)
println("Your input was \"", y, "\".\n")
catch
println("Sorry, but \"", y, "\" does not compute as an integer.")
end
| string = raw_input("Input a string: ")
|
Rewrite this program in VB while keeping its functionality equivalent to the Julia version. | print("String? ")
y = readline()
println("Your input was \"", y, "\".\n")
print("Integer? ")
y = readline()
try
y = parse(Int, y)
println("Your input was \"", y, "\".\n")
catch
println("Sorry, but \"", y, "\" does not compute as an integer.")
end
| Public Sub text()
Debug.Print InputBox("Input a string")
Debug.Print InputBox("Input the integer 75000", "Input an integer", 75000, Context = "Long")
End Sub
|
Generate an equivalent Go version of this Julia code. | print("String? ")
y = readline()
println("Your input was \"", y, "\".\n")
print("Integer? ")
y = readline()
try
y = parse(Int, y)
println("Your input was \"", y, "\".\n")
catch
println("Sorry, but \"", y, "\" does not compute as an integer.")
end
| package main
import "fmt"
func main() {
var s string
var i int
if _, err := fmt.Scan(&s, &i); err == nil && i == 75000 {
fmt.Println("good")
} else {
fmt.Println("wrong")
}
}
|
Ensure the translated C code behaves exactly like the original Lua snippet. | print('Enter a string: ')
s = io.stdin:read()
print('Enter a number: ')
i = tonumber(io.stdin:read())
| #include <stdio.h>
#include <stdlib.h>
int main(void)
{
char str[BUFSIZ];
puts("Enter a string: ");
fgets(str, sizeof(str), stdin);
long num;
char buf[BUFSIZ];
do
{
puts("Enter 75000: ");
fgets(buf, sizeof(buf), stdin);
num = strtol(buf, NULL, 10);
} w... |
Produce a functionally identical C# code for the snippet given in Lua. | print('Enter a string: ')
s = io.stdin:read()
print('Enter a number: ')
i = tonumber(io.stdin:read())
| using System;
namespace C_Sharp_Console {
class example {
static void Main() {
string word;
int num;
Console.Write("Enter an integer: ");
num = Console.Read();
Console.Write("Enter a String: ");
word = Console.ReadLine()... |
Can you help me rewrite this code in C++ instead of Lua, keeping it the same logically? | print('Enter a string: ')
s = io.stdin:read()
print('Enter a number: ')
i = tonumber(io.stdin:read())
| #include <iostream>
#include <string>
using namespace std;
int main()
{
long int integer_input;
string string_input;
cout << "Enter an integer: ";
cin >> integer_input;
cout << "Enter a string: ";
cin >> string_input;
return 0;
}
|
Translate the given Lua code snippet into Java without altering its behavior. | print('Enter a string: ')
s = io.stdin:read()
print('Enter a number: ')
i = tonumber(io.stdin:read())
| import java.util.Scanner;
public class GetInput {
public static void main(String[] args) throws Exception {
Scanner s = new Scanner(System.in);
System.out.print("Enter a string: ");
String str = s.nextLine();
System.out.print("Enter an integer: ");
int i = Integer.parseInt(s... |
Translate this program into Python but keep the logic exactly as in Lua. | print('Enter a string: ')
s = io.stdin:read()
print('Enter a number: ')
i = tonumber(io.stdin:read())
| string = raw_input("Input a string: ")
|
Rewrite the snippet below in VB so it works the same as the original Lua code. | print('Enter a string: ')
s = io.stdin:read()
print('Enter a number: ')
i = tonumber(io.stdin:read())
| Public Sub text()
Debug.Print InputBox("Input a string")
Debug.Print InputBox("Input the integer 75000", "Input an integer", 75000, Context = "Long")
End Sub
|
Generate a Go translation of this Lua snippet without changing its computational steps. | print('Enter a string: ')
s = io.stdin:read()
print('Enter a number: ')
i = tonumber(io.stdin:read())
| package main
import "fmt"
func main() {
var s string
var i int
if _, err := fmt.Scan(&s, &i); err == nil && i == 75000 {
fmt.Println("good")
} else {
fmt.Println("wrong")
}
}
|
Write the same code in C as shown below in Mathematica. | mystring = InputString["give me a string please"];
myinteger = Input["give me an integer please"];
| #include <stdio.h>
#include <stdlib.h>
int main(void)
{
char str[BUFSIZ];
puts("Enter a string: ");
fgets(str, sizeof(str), stdin);
long num;
char buf[BUFSIZ];
do
{
puts("Enter 75000: ");
fgets(buf, sizeof(buf), stdin);
num = strtol(buf, NULL, 10);
} w... |
Write the same code in C# as shown below in Mathematica. | mystring = InputString["give me a string please"];
myinteger = Input["give me an integer please"];
| using System;
namespace C_Sharp_Console {
class example {
static void Main() {
string word;
int num;
Console.Write("Enter an integer: ");
num = Console.Read();
Console.Write("Enter a String: ");
word = Console.ReadLine()... |
Port the following code from Mathematica to C++ with equivalent syntax and logic. | mystring = InputString["give me a string please"];
myinteger = Input["give me an integer please"];
| #include <iostream>
#include <string>
using namespace std;
int main()
{
long int integer_input;
string string_input;
cout << "Enter an integer: ";
cin >> integer_input;
cout << "Enter a string: ";
cin >> string_input;
return 0;
}
|
Rewrite the snippet below in Java so it works the same as the original Mathematica code. | mystring = InputString["give me a string please"];
myinteger = Input["give me an integer please"];
| import java.util.Scanner;
public class GetInput {
public static void main(String[] args) throws Exception {
Scanner s = new Scanner(System.in);
System.out.print("Enter a string: ");
String str = s.nextLine();
System.out.print("Enter an integer: ");
int i = Integer.parseInt(s... |
Ensure the translated Python code behaves exactly like the original Mathematica snippet. | mystring = InputString["give me a string please"];
myinteger = Input["give me an integer please"];
| string = raw_input("Input a string: ")
|
Write the same algorithm in VB as shown in this Mathematica implementation. | mystring = InputString["give me a string please"];
myinteger = Input["give me an integer please"];
| Public Sub text()
Debug.Print InputBox("Input a string")
Debug.Print InputBox("Input the integer 75000", "Input an integer", 75000, Context = "Long")
End Sub
|
Generate an equivalent Go version of this Mathematica code. | mystring = InputString["give me a string please"];
myinteger = Input["give me an integer please"];
| package main
import "fmt"
func main() {
var s string
var i int
if _, err := fmt.Scan(&s, &i); err == nil && i == 75000 {
fmt.Println("good")
} else {
fmt.Println("wrong")
}
}
|
Translate this program into C but keep the logic exactly as in MATLAB. | >> input('Input string: ')
Input string: 'Hello'
ans =
Hello
>> input('Input number: ')
Input number: 75000
ans =
75000
>> input('Input number, the number will be stored as a string: ','s')
Input number, the number will be stored as a string: 75000
ans =
75000
| #include <stdio.h>
#include <stdlib.h>
int main(void)
{
char str[BUFSIZ];
puts("Enter a string: ");
fgets(str, sizeof(str), stdin);
long num;
char buf[BUFSIZ];
do
{
puts("Enter 75000: ");
fgets(buf, sizeof(buf), stdin);
num = strtol(buf, NULL, 10);
} w... |
Write a version of this MATLAB function in C# with identical behavior. | >> input('Input string: ')
Input string: 'Hello'
ans =
Hello
>> input('Input number: ')
Input number: 75000
ans =
75000
>> input('Input number, the number will be stored as a string: ','s')
Input number, the number will be stored as a string: 75000
ans =
75000
| using System;
namespace C_Sharp_Console {
class example {
static void Main() {
string word;
int num;
Console.Write("Enter an integer: ");
num = Console.Read();
Console.Write("Enter a String: ");
word = Console.ReadLine()... |
Can you help me rewrite this code in C++ instead of MATLAB, keeping it the same logically? | >> input('Input string: ')
Input string: 'Hello'
ans =
Hello
>> input('Input number: ')
Input number: 75000
ans =
75000
>> input('Input number, the number will be stored as a string: ','s')
Input number, the number will be stored as a string: 75000
ans =
75000
| #include <iostream>
#include <string>
using namespace std;
int main()
{
long int integer_input;
string string_input;
cout << "Enter an integer: ";
cin >> integer_input;
cout << "Enter a string: ";
cin >> string_input;
return 0;
}
|
Maintain the same structure and functionality when rewriting this code in Java. | >> input('Input string: ')
Input string: 'Hello'
ans =
Hello
>> input('Input number: ')
Input number: 75000
ans =
75000
>> input('Input number, the number will be stored as a string: ','s')
Input number, the number will be stored as a string: 75000
ans =
75000
| import java.util.Scanner;
public class GetInput {
public static void main(String[] args) throws Exception {
Scanner s = new Scanner(System.in);
System.out.print("Enter a string: ");
String str = s.nextLine();
System.out.print("Enter an integer: ");
int i = Integer.parseInt(s... |
Produce a language-to-language conversion: from MATLAB to Python, same semantics. | >> input('Input string: ')
Input string: 'Hello'
ans =
Hello
>> input('Input number: ')
Input number: 75000
ans =
75000
>> input('Input number, the number will be stored as a string: ','s')
Input number, the number will be stored as a string: 75000
ans =
75000
| string = raw_input("Input a string: ")
|
Maintain the same structure and functionality when rewriting this code in VB. | >> input('Input string: ')
Input string: 'Hello'
ans =
Hello
>> input('Input number: ')
Input number: 75000
ans =
75000
>> input('Input number, the number will be stored as a string: ','s')
Input number, the number will be stored as a string: 75000
ans =
75000
| Public Sub text()
Debug.Print InputBox("Input a string")
Debug.Print InputBox("Input the integer 75000", "Input an integer", 75000, Context = "Long")
End Sub
|
Translate this program into Go but keep the logic exactly as in MATLAB. | >> input('Input string: ')
Input string: 'Hello'
ans =
Hello
>> input('Input number: ')
Input number: 75000
ans =
75000
>> input('Input number, the number will be stored as a string: ','s')
Input number, the number will be stored as a string: 75000
ans =
75000
| package main
import "fmt"
func main() {
var s string
var i int
if _, err := fmt.Scan(&s, &i); err == nil && i == 75000 {
fmt.Println("good")
} else {
fmt.Println("wrong")
}
}
|
Port the following code from Nim to C with equivalent syntax and logic. | import rdstdin, strutils
let str = readLineFromStdin "Input a string: "
let num = parseInt(readLineFromStdin "Input an integer: ")
| #include <stdio.h>
#include <stdlib.h>
int main(void)
{
char str[BUFSIZ];
puts("Enter a string: ");
fgets(str, sizeof(str), stdin);
long num;
char buf[BUFSIZ];
do
{
puts("Enter 75000: ");
fgets(buf, sizeof(buf), stdin);
num = strtol(buf, NULL, 10);
} w... |
Port the following code from Nim to C# with equivalent syntax and logic. | import rdstdin, strutils
let str = readLineFromStdin "Input a string: "
let num = parseInt(readLineFromStdin "Input an integer: ")
| using System;
namespace C_Sharp_Console {
class example {
static void Main() {
string word;
int num;
Console.Write("Enter an integer: ");
num = Console.Read();
Console.Write("Enter a String: ");
word = Console.ReadLine()... |
Produce a functionally identical C++ code for the snippet given in Nim. | import rdstdin, strutils
let str = readLineFromStdin "Input a string: "
let num = parseInt(readLineFromStdin "Input an integer: ")
| #include <iostream>
#include <string>
using namespace std;
int main()
{
long int integer_input;
string string_input;
cout << "Enter an integer: ";
cin >> integer_input;
cout << "Enter a string: ";
cin >> string_input;
return 0;
}
|
Preserve the algorithm and functionality while converting the code from Nim to Java. | import rdstdin, strutils
let str = readLineFromStdin "Input a string: "
let num = parseInt(readLineFromStdin "Input an integer: ")
| import java.util.Scanner;
public class GetInput {
public static void main(String[] args) throws Exception {
Scanner s = new Scanner(System.in);
System.out.print("Enter a string: ");
String str = s.nextLine();
System.out.print("Enter an integer: ");
int i = Integer.parseInt(s... |
Write a version of this Nim function in Python with identical behavior. | import rdstdin, strutils
let str = readLineFromStdin "Input a string: "
let num = parseInt(readLineFromStdin "Input an integer: ")
| string = raw_input("Input a string: ")
|
Rewrite this program in VB while keeping its functionality equivalent to the Nim version. | import rdstdin, strutils
let str = readLineFromStdin "Input a string: "
let num = parseInt(readLineFromStdin "Input an integer: ")
| Public Sub text()
Debug.Print InputBox("Input a string")
Debug.Print InputBox("Input the integer 75000", "Input an integer", 75000, Context = "Long")
End Sub
|
Ensure the translated Go code behaves exactly like the original Nim snippet. | import rdstdin, strutils
let str = readLineFromStdin "Input a string: "
let num = parseInt(readLineFromStdin "Input an integer: ")
| package main
import "fmt"
func main() {
var s string
var i int
if _, err := fmt.Scan(&s, &i); err == nil && i == 75000 {
fmt.Println("good")
} else {
fmt.Println("wrong")
}
}
|
Convert this OCaml snippet to C and keep its semantics consistent. | print_string "Enter a string: ";
let str = read_line () in
print_string "Enter an integer: ";
let num = read_int () in
Printf.printf "%s%d\n" str num
| #include <stdio.h>
#include <stdlib.h>
int main(void)
{
char str[BUFSIZ];
puts("Enter a string: ");
fgets(str, sizeof(str), stdin);
long num;
char buf[BUFSIZ];
do
{
puts("Enter 75000: ");
fgets(buf, sizeof(buf), stdin);
num = strtol(buf, NULL, 10);
} w... |
Convert the following code from OCaml to C#, ensuring the logic remains intact. | print_string "Enter a string: ";
let str = read_line () in
print_string "Enter an integer: ";
let num = read_int () in
Printf.printf "%s%d\n" str num
| using System;
namespace C_Sharp_Console {
class example {
static void Main() {
string word;
int num;
Console.Write("Enter an integer: ");
num = Console.Read();
Console.Write("Enter a String: ");
word = Console.ReadLine()... |
Port the following code from OCaml to C++ with equivalent syntax and logic. | print_string "Enter a string: ";
let str = read_line () in
print_string "Enter an integer: ";
let num = read_int () in
Printf.printf "%s%d\n" str num
| #include <iostream>
#include <string>
using namespace std;
int main()
{
long int integer_input;
string string_input;
cout << "Enter an integer: ";
cin >> integer_input;
cout << "Enter a string: ";
cin >> string_input;
return 0;
}
|
Translate the given OCaml code snippet into Java without altering its behavior. | print_string "Enter a string: ";
let str = read_line () in
print_string "Enter an integer: ";
let num = read_int () in
Printf.printf "%s%d\n" str num
| import java.util.Scanner;
public class GetInput {
public static void main(String[] args) throws Exception {
Scanner s = new Scanner(System.in);
System.out.print("Enter a string: ");
String str = s.nextLine();
System.out.print("Enter an integer: ");
int i = Integer.parseInt(s... |
Convert this OCaml snippet to Python and keep its semantics consistent. | print_string "Enter a string: ";
let str = read_line () in
print_string "Enter an integer: ";
let num = read_int () in
Printf.printf "%s%d\n" str num
| string = raw_input("Input a string: ")
|
Convert this OCaml snippet to VB and keep its semantics consistent. | print_string "Enter a string: ";
let str = read_line () in
print_string "Enter an integer: ";
let num = read_int () in
Printf.printf "%s%d\n" str num
| Public Sub text()
Debug.Print InputBox("Input a string")
Debug.Print InputBox("Input the integer 75000", "Input an integer", 75000, Context = "Long")
End Sub
|
Convert this OCaml snippet to Go and keep its semantics consistent. | print_string "Enter a string: ";
let str = read_line () in
print_string "Enter an integer: ";
let num = read_int () in
Printf.printf "%s%d\n" str num
| package main
import "fmt"
func main() {
var s string
var i int
if _, err := fmt.Scan(&s, &i); err == nil && i == 75000 {
fmt.Println("good")
} else {
fmt.Println("wrong")
}
}
|
Port the following code from Pascal to C with equivalent syntax and logic. | program UserInput(input, output);
var i : Integer;
s : String;
begin
write('Enter an integer: ');
readln(i);
write('Enter a string: ');
readln(s)
end.
| #include <stdio.h>
#include <stdlib.h>
int main(void)
{
char str[BUFSIZ];
puts("Enter a string: ");
fgets(str, sizeof(str), stdin);
long num;
char buf[BUFSIZ];
do
{
puts("Enter 75000: ");
fgets(buf, sizeof(buf), stdin);
num = strtol(buf, NULL, 10);
} w... |
Produce a functionally identical C++ code for the snippet given in Pascal. | program UserInput(input, output);
var i : Integer;
s : String;
begin
write('Enter an integer: ');
readln(i);
write('Enter a string: ');
readln(s)
end.
| #include <iostream>
#include <string>
using namespace std;
int main()
{
long int integer_input;
string string_input;
cout << "Enter an integer: ";
cin >> integer_input;
cout << "Enter a string: ";
cin >> string_input;
return 0;
}
|
Write the same algorithm in Java as shown in this Pascal implementation. | program UserInput(input, output);
var i : Integer;
s : String;
begin
write('Enter an integer: ');
readln(i);
write('Enter a string: ');
readln(s)
end.
| import java.util.Scanner;
public class GetInput {
public static void main(String[] args) throws Exception {
Scanner s = new Scanner(System.in);
System.out.print("Enter a string: ");
String str = s.nextLine();
System.out.print("Enter an integer: ");
int i = Integer.parseInt(s... |
Convert the following code from Pascal to Python, ensuring the logic remains intact. | program UserInput(input, output);
var i : Integer;
s : String;
begin
write('Enter an integer: ');
readln(i);
write('Enter a string: ');
readln(s)
end.
| string = raw_input("Input a string: ")
|
Port the following code from Pascal to VB with equivalent syntax and logic. | program UserInput(input, output);
var i : Integer;
s : String;
begin
write('Enter an integer: ');
readln(i);
write('Enter a string: ');
readln(s)
end.
| Public Sub text()
Debug.Print InputBox("Input a string")
Debug.Print InputBox("Input the integer 75000", "Input an integer", 75000, Context = "Long")
End Sub
|
Produce a language-to-language conversion: from Pascal to Go, same semantics. | program UserInput(input, output);
var i : Integer;
s : String;
begin
write('Enter an integer: ');
readln(i);
write('Enter a string: ');
readln(s)
end.
| package main
import "fmt"
func main() {
var s string
var i int
if _, err := fmt.Scan(&s, &i); err == nil && i == 75000 {
fmt.Println("good")
} else {
fmt.Println("wrong")
}
}
|
Write the same algorithm in C as shown in this Perl implementation. | print "Enter a string: ";
my $string = <>;
print "Enter an integer: ";
my $integer = <>;
| #include <stdio.h>
#include <stdlib.h>
int main(void)
{
char str[BUFSIZ];
puts("Enter a string: ");
fgets(str, sizeof(str), stdin);
long num;
char buf[BUFSIZ];
do
{
puts("Enter 75000: ");
fgets(buf, sizeof(buf), stdin);
num = strtol(buf, NULL, 10);
} w... |
Convert this Perl block to C#, preserving its control flow and logic. | print "Enter a string: ";
my $string = <>;
print "Enter an integer: ";
my $integer = <>;
| using System;
namespace C_Sharp_Console {
class example {
static void Main() {
string word;
int num;
Console.Write("Enter an integer: ");
num = Console.Read();
Console.Write("Enter a String: ");
word = Console.ReadLine()... |
Write the same code in C++ as shown below in Perl. | print "Enter a string: ";
my $string = <>;
print "Enter an integer: ";
my $integer = <>;
| #include <iostream>
#include <string>
using namespace std;
int main()
{
long int integer_input;
string string_input;
cout << "Enter an integer: ";
cin >> integer_input;
cout << "Enter a string: ";
cin >> string_input;
return 0;
}
|
Port the provided Perl code into Java while preserving the original functionality. | print "Enter a string: ";
my $string = <>;
print "Enter an integer: ";
my $integer = <>;
| import java.util.Scanner;
public class GetInput {
public static void main(String[] args) throws Exception {
Scanner s = new Scanner(System.in);
System.out.print("Enter a string: ");
String str = s.nextLine();
System.out.print("Enter an integer: ");
int i = Integer.parseInt(s... |
Convert the following code from Perl to Python, ensuring the logic remains intact. | print "Enter a string: ";
my $string = <>;
print "Enter an integer: ";
my $integer = <>;
| string = raw_input("Input a string: ")
|
Change the programming language of this snippet from Perl to VB without modifying what it does. | print "Enter a string: ";
my $string = <>;
print "Enter an integer: ";
my $integer = <>;
| Public Sub text()
Debug.Print InputBox("Input a string")
Debug.Print InputBox("Input the integer 75000", "Input an integer", 75000, Context = "Long")
End Sub
|
Transform the following Perl implementation into Go, maintaining the same output and logic. | print "Enter a string: ";
my $string = <>;
print "Enter an integer: ";
my $integer = <>;
| package main
import "fmt"
func main() {
var s string
var i int
if _, err := fmt.Scan(&s, &i); err == nil && i == 75000 {
fmt.Println("good")
} else {
fmt.Println("wrong")
}
}
|
Generate a C translation of this PowerShell snippet without changing its computational steps. | $string = Read-Host "Input a string"
[int]$number = Read-Host "Input a number"
| #include <stdio.h>
#include <stdlib.h>
int main(void)
{
char str[BUFSIZ];
puts("Enter a string: ");
fgets(str, sizeof(str), stdin);
long num;
char buf[BUFSIZ];
do
{
puts("Enter 75000: ");
fgets(buf, sizeof(buf), stdin);
num = strtol(buf, NULL, 10);
} w... |
Can you help me rewrite this code in C# instead of PowerShell, keeping it the same logically? | $string = Read-Host "Input a string"
[int]$number = Read-Host "Input a number"
| using System;
namespace C_Sharp_Console {
class example {
static void Main() {
string word;
int num;
Console.Write("Enter an integer: ");
num = Console.Read();
Console.Write("Enter a String: ");
word = Console.ReadLine()... |
Write a version of this PowerShell function in C++ with identical behavior. | $string = Read-Host "Input a string"
[int]$number = Read-Host "Input a number"
| #include <iostream>
#include <string>
using namespace std;
int main()
{
long int integer_input;
string string_input;
cout << "Enter an integer: ";
cin >> integer_input;
cout << "Enter a string: ";
cin >> string_input;
return 0;
}
|
Generate an equivalent Java version of this PowerShell code. | $string = Read-Host "Input a string"
[int]$number = Read-Host "Input a number"
| import java.util.Scanner;
public class GetInput {
public static void main(String[] args) throws Exception {
Scanner s = new Scanner(System.in);
System.out.print("Enter a string: ");
String str = s.nextLine();
System.out.print("Enter an integer: ");
int i = Integer.parseInt(s... |
Change the programming language of this snippet from PowerShell to Python without modifying what it does. | $string = Read-Host "Input a string"
[int]$number = Read-Host "Input a number"
| string = raw_input("Input a string: ")
|
Write the same code in VB as shown below in PowerShell. | $string = Read-Host "Input a string"
[int]$number = Read-Host "Input a number"
| Public Sub text()
Debug.Print InputBox("Input a string")
Debug.Print InputBox("Input the integer 75000", "Input an integer", 75000, Context = "Long")
End Sub
|
Generate an equivalent Go version of this PowerShell code. | $string = Read-Host "Input a string"
[int]$number = Read-Host "Input a number"
| package main
import "fmt"
func main() {
var s string
var i int
if _, err := fmt.Scan(&s, &i); err == nil && i == 75000 {
fmt.Println("good")
} else {
fmt.Println("wrong")
}
}
|
Produce a language-to-language conversion: from R to C, same semantics. | stringval <- readline("String: ")
intval <- as.integer(readline("Integer: "))
| #include <stdio.h>
#include <stdlib.h>
int main(void)
{
char str[BUFSIZ];
puts("Enter a string: ");
fgets(str, sizeof(str), stdin);
long num;
char buf[BUFSIZ];
do
{
puts("Enter 75000: ");
fgets(buf, sizeof(buf), stdin);
num = strtol(buf, NULL, 10);
} w... |
Translate the given R code snippet into C# without altering its behavior. | stringval <- readline("String: ")
intval <- as.integer(readline("Integer: "))
| using System;
namespace C_Sharp_Console {
class example {
static void Main() {
string word;
int num;
Console.Write("Enter an integer: ");
num = Console.Read();
Console.Write("Enter a String: ");
word = Console.ReadLine()... |
Translate the given R code snippet into C++ without altering its behavior. | stringval <- readline("String: ")
intval <- as.integer(readline("Integer: "))
| #include <iostream>
#include <string>
using namespace std;
int main()
{
long int integer_input;
string string_input;
cout << "Enter an integer: ";
cin >> integer_input;
cout << "Enter a string: ";
cin >> string_input;
return 0;
}
|
Write the same algorithm in Java as shown in this R implementation. | stringval <- readline("String: ")
intval <- as.integer(readline("Integer: "))
| import java.util.Scanner;
public class GetInput {
public static void main(String[] args) throws Exception {
Scanner s = new Scanner(System.in);
System.out.print("Enter a string: ");
String str = s.nextLine();
System.out.print("Enter an integer: ");
int i = Integer.parseInt(s... |
Write the same algorithm in VB as shown in this R implementation. | stringval <- readline("String: ")
intval <- as.integer(readline("Integer: "))
| Public Sub text()
Debug.Print InputBox("Input a string")
Debug.Print InputBox("Input the integer 75000", "Input an integer", 75000, Context = "Long")
End Sub
|
Ensure the translated Go code behaves exactly like the original R snippet. | stringval <- readline("String: ")
intval <- as.integer(readline("Integer: "))
| package main
import "fmt"
func main() {
var s string
var i int
if _, err := fmt.Scan(&s, &i); err == nil && i == 75000 {
fmt.Println("good")
} else {
fmt.Println("wrong")
}
}
|
Preserve the algorithm and functionality while converting the code from Racket to C. | #lang racket
(printf "Input a string: ")
(define s (read-line))
(printf "You entered: ~a\n" s)
(printf "Input a number: ")
(define m (or (string->number (read-line))
(error "I said a number!")))
(printf "You entered: ~a\n" m)
(printf "Input a number: ")
(define n (read))
(unless (number? n) (error "I s... | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
char str[BUFSIZ];
puts("Enter a string: ");
fgets(str, sizeof(str), stdin);
long num;
char buf[BUFSIZ];
do
{
puts("Enter 75000: ");
fgets(buf, sizeof(buf), stdin);
num = strtol(buf, NULL, 10);
} w... |
Rewrite the snippet below in C# so it works the same as the original Racket code. | #lang racket
(printf "Input a string: ")
(define s (read-line))
(printf "You entered: ~a\n" s)
(printf "Input a number: ")
(define m (or (string->number (read-line))
(error "I said a number!")))
(printf "You entered: ~a\n" m)
(printf "Input a number: ")
(define n (read))
(unless (number? n) (error "I s... | using System;
namespace C_Sharp_Console {
class example {
static void Main() {
string word;
int num;
Console.Write("Enter an integer: ");
num = Console.Read();
Console.Write("Enter a String: ");
word = Console.ReadLine()... |
Transform the following Racket implementation into C++, maintaining the same output and logic. | #lang racket
(printf "Input a string: ")
(define s (read-line))
(printf "You entered: ~a\n" s)
(printf "Input a number: ")
(define m (or (string->number (read-line))
(error "I said a number!")))
(printf "You entered: ~a\n" m)
(printf "Input a number: ")
(define n (read))
(unless (number? n) (error "I s... | #include <iostream>
#include <string>
using namespace std;
int main()
{
long int integer_input;
string string_input;
cout << "Enter an integer: ";
cin >> integer_input;
cout << "Enter a string: ";
cin >> string_input;
return 0;
}
|
Keep all operations the same but rewrite the snippet in Java. | #lang racket
(printf "Input a string: ")
(define s (read-line))
(printf "You entered: ~a\n" s)
(printf "Input a number: ")
(define m (or (string->number (read-line))
(error "I said a number!")))
(printf "You entered: ~a\n" m)
(printf "Input a number: ")
(define n (read))
(unless (number? n) (error "I s... | import java.util.Scanner;
public class GetInput {
public static void main(String[] args) throws Exception {
Scanner s = new Scanner(System.in);
System.out.print("Enter a string: ");
String str = s.nextLine();
System.out.print("Enter an integer: ");
int i = Integer.parseInt(s... |
Convert this Racket block to Python, preserving its control flow and logic. | #lang racket
(printf "Input a string: ")
(define s (read-line))
(printf "You entered: ~a\n" s)
(printf "Input a number: ")
(define m (or (string->number (read-line))
(error "I said a number!")))
(printf "You entered: ~a\n" m)
(printf "Input a number: ")
(define n (read))
(unless (number? n) (error "I s... | string = raw_input("Input a string: ")
|
Produce a language-to-language conversion: from Racket to VB, same semantics. | #lang racket
(printf "Input a string: ")
(define s (read-line))
(printf "You entered: ~a\n" s)
(printf "Input a number: ")
(define m (or (string->number (read-line))
(error "I said a number!")))
(printf "You entered: ~a\n" m)
(printf "Input a number: ")
(define n (read))
(unless (number? n) (error "I s... | Public Sub text()
Debug.Print InputBox("Input a string")
Debug.Print InputBox("Input the integer 75000", "Input an integer", 75000, Context = "Long")
End Sub
|
Convert this Racket block to Go, preserving its control flow and logic. | #lang racket
(printf "Input a string: ")
(define s (read-line))
(printf "You entered: ~a\n" s)
(printf "Input a number: ")
(define m (or (string->number (read-line))
(error "I said a number!")))
(printf "You entered: ~a\n" m)
(printf "Input a number: ")
(define n (read))
(unless (number? n) (error "I s... | package main
import "fmt"
func main() {
var s string
var i int
if _, err := fmt.Scan(&s, &i); err == nil && i == 75000 {
fmt.Println("good")
} else {
fmt.Println("wrong")
}
}
|
Please provide an equivalent version of this COBOL code in C. | IDENTIFICATION DIVISION.
PROGRAM-ID. Get-Input.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 Input-String PIC X(30).
01 Input-Int PIC 9(5).
PROCEDURE DIVISION.
DISPLAY "Enter a string:"
ACCEPT Input-String
DISPLAY "Enter a number:"
ACCEP... | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
char str[BUFSIZ];
puts("Enter a string: ");
fgets(str, sizeof(str), stdin);
long num;
char buf[BUFSIZ];
do
{
puts("Enter 75000: ");
fgets(buf, sizeof(buf), stdin);
num = strtol(buf, NULL, 10);
} w... |
Write the same algorithm in C# as shown in this COBOL implementation. | IDENTIFICATION DIVISION.
PROGRAM-ID. Get-Input.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 Input-String PIC X(30).
01 Input-Int PIC 9(5).
PROCEDURE DIVISION.
DISPLAY "Enter a string:"
ACCEPT Input-String
DISPLAY "Enter a number:"
ACCEP... | using System;
namespace C_Sharp_Console {
class example {
static void Main() {
string word;
int num;
Console.Write("Enter an integer: ");
num = Console.Read();
Console.Write("Enter a String: ");
word = Console.ReadLine()... |
Produce a functionally identical C++ code for the snippet given in COBOL. | IDENTIFICATION DIVISION.
PROGRAM-ID. Get-Input.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 Input-String PIC X(30).
01 Input-Int PIC 9(5).
PROCEDURE DIVISION.
DISPLAY "Enter a string:"
ACCEPT Input-String
DISPLAY "Enter a number:"
ACCEP... | #include <iostream>
#include <string>
using namespace std;
int main()
{
long int integer_input;
string string_input;
cout << "Enter an integer: ";
cin >> integer_input;
cout << "Enter a string: ";
cin >> string_input;
return 0;
}
|
Maintain the same structure and functionality when rewriting this code in Java. | IDENTIFICATION DIVISION.
PROGRAM-ID. Get-Input.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 Input-String PIC X(30).
01 Input-Int PIC 9(5).
PROCEDURE DIVISION.
DISPLAY "Enter a string:"
ACCEPT Input-String
DISPLAY "Enter a number:"
ACCEP... | import java.util.Scanner;
public class GetInput {
public static void main(String[] args) throws Exception {
Scanner s = new Scanner(System.in);
System.out.print("Enter a string: ");
String str = s.nextLine();
System.out.print("Enter an integer: ");
int i = Integer.parseInt(s... |
Convert this COBOL block to Python, preserving its control flow and logic. | IDENTIFICATION DIVISION.
PROGRAM-ID. Get-Input.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 Input-String PIC X(30).
01 Input-Int PIC 9(5).
PROCEDURE DIVISION.
DISPLAY "Enter a string:"
ACCEPT Input-String
DISPLAY "Enter a number:"
ACCEP... | string = raw_input("Input a string: ")
|
Convert this COBOL block to VB, preserving its control flow and logic. | IDENTIFICATION DIVISION.
PROGRAM-ID. Get-Input.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 Input-String PIC X(30).
01 Input-Int PIC 9(5).
PROCEDURE DIVISION.
DISPLAY "Enter a string:"
ACCEPT Input-String
DISPLAY "Enter a number:"
ACCEP... | Public Sub text()
Debug.Print InputBox("Input a string")
Debug.Print InputBox("Input the integer 75000", "Input an integer", 75000, Context = "Long")
End Sub
|
Produce a functionally identical Go code for the snippet given in COBOL. | IDENTIFICATION DIVISION.
PROGRAM-ID. Get-Input.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 Input-String PIC X(30).
01 Input-Int PIC 9(5).
PROCEDURE DIVISION.
DISPLAY "Enter a string:"
ACCEPT Input-String
DISPLAY "Enter a number:"
ACCEP... | package main
import "fmt"
func main() {
var s string
var i int
if _, err := fmt.Scan(&s, &i); err == nil && i == 75000 {
fmt.Println("good")
} else {
fmt.Println("wrong")
}
}
|
Port the following code from REXX to C with equivalent syntax and logic. |
options replace format comments java crossref symbols nobinary
checkVal = 75000
say 'Input a string then the number' checkVal
parse ask inString
parse ask inNumber .
say 'Input string:' inString
say 'Input number:' inNumber
if inNumber == checkVal then do
say 'Success! Input number is as requested'
end
else do
... | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
char str[BUFSIZ];
puts("Enter a string: ");
fgets(str, sizeof(str), stdin);
long num;
char buf[BUFSIZ];
do
{
puts("Enter 75000: ");
fgets(buf, sizeof(buf), stdin);
num = strtol(buf, NULL, 10);
} w... |
Preserve the algorithm and functionality while converting the code from REXX to C#. |
options replace format comments java crossref symbols nobinary
checkVal = 75000
say 'Input a string then the number' checkVal
parse ask inString
parse ask inNumber .
say 'Input string:' inString
say 'Input number:' inNumber
if inNumber == checkVal then do
say 'Success! Input number is as requested'
end
else do
... | using System;
namespace C_Sharp_Console {
class example {
static void Main() {
string word;
int num;
Console.Write("Enter an integer: ");
num = Console.Read();
Console.Write("Enter a String: ");
word = Console.ReadLine()... |
Produce a language-to-language conversion: from REXX to C++, same semantics. |
options replace format comments java crossref symbols nobinary
checkVal = 75000
say 'Input a string then the number' checkVal
parse ask inString
parse ask inNumber .
say 'Input string:' inString
say 'Input number:' inNumber
if inNumber == checkVal then do
say 'Success! Input number is as requested'
end
else do
... | #include <iostream>
#include <string>
using namespace std;
int main()
{
long int integer_input;
string string_input;
cout << "Enter an integer: ";
cin >> integer_input;
cout << "Enter a string: ";
cin >> string_input;
return 0;
}
|
Change the following REXX code into Java without altering its purpose. |
options replace format comments java crossref symbols nobinary
checkVal = 75000
say 'Input a string then the number' checkVal
parse ask inString
parse ask inNumber .
say 'Input string:' inString
say 'Input number:' inNumber
if inNumber == checkVal then do
say 'Success! Input number is as requested'
end
else do
... | import java.util.Scanner;
public class GetInput {
public static void main(String[] args) throws Exception {
Scanner s = new Scanner(System.in);
System.out.print("Enter a string: ");
String str = s.nextLine();
System.out.print("Enter an integer: ");
int i = Integer.parseInt(s... |
Rewrite the snippet below in Python so it works the same as the original REXX code. |
options replace format comments java crossref symbols nobinary
checkVal = 75000
say 'Input a string then the number' checkVal
parse ask inString
parse ask inNumber .
say 'Input string:' inString
say 'Input number:' inNumber
if inNumber == checkVal then do
say 'Success! Input number is as requested'
end
else do
... | string = raw_input("Input a string: ")
|
Can you help me rewrite this code in VB instead of REXX, keeping it the same logically? |
options replace format comments java crossref symbols nobinary
checkVal = 75000
say 'Input a string then the number' checkVal
parse ask inString
parse ask inNumber .
say 'Input string:' inString
say 'Input number:' inNumber
if inNumber == checkVal then do
say 'Success! Input number is as requested'
end
else do
... | Public Sub text()
Debug.Print InputBox("Input a string")
Debug.Print InputBox("Input the integer 75000", "Input an integer", 75000, Context = "Long")
End Sub
|
Transform the following REXX implementation into Go, maintaining the same output and logic. |
options replace format comments java crossref symbols nobinary
checkVal = 75000
say 'Input a string then the number' checkVal
parse ask inString
parse ask inNumber .
say 'Input string:' inString
say 'Input number:' inNumber
if inNumber == checkVal then do
say 'Success! Input number is as requested'
end
else do
... | package main
import "fmt"
func main() {
var s string
var i int
if _, err := fmt.Scan(&s, &i); err == nil && i == 75000 {
fmt.Println("good")
} else {
fmt.Println("wrong")
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.