Instruction
stringlengths
45
106
input_code
stringlengths
1
13.7k
output_code
stringlengths
1
13.7k
Convert this D block to C++, preserving its control flow and logic.
import std.stdio, std.process; void main() { auto home = getenv("HOME"); }
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Port the provided D code into Java while preserving the original functionality.
import std.stdio, std.process; void main() { auto home = getenv("HOME"); }
System.getenv("HOME") System.getenv()
Translate this program into Go but keep the logic exactly as in D.
import std.stdio, std.process; void main() { auto home = getenv("HOME"); }
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Maintain the same structure and functionality when rewriting this code in C.
program EnvironmentVariable; uses SysUtils; begin WriteLn('Temp = ' + GetEnvironmentVariable('TEMP')); end.
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Write the same code in C# as shown below in Delphi.
program EnvironmentVariable; uses SysUtils; begin WriteLn('Temp = ' + GetEnvironmentVariable('TEMP')); end.
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Generate an equivalent C++ version of this Delphi code.
program EnvironmentVariable; uses SysUtils; begin WriteLn('Temp = ' + GetEnvironmentVariable('TEMP')); end.
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Convert this Delphi snippet to Java and keep its semantics consistent.
program EnvironmentVariable; uses SysUtils; begin WriteLn('Temp = ' + GetEnvironmentVariable('TEMP')); end.
System.getenv("HOME") System.getenv()
Write the same algorithm in Python as shown in this Delphi implementation.
program EnvironmentVariable; uses SysUtils; begin WriteLn('Temp = ' + GetEnvironmentVariable('TEMP')); end.
import os os.environ['HOME']
Transform the following Delphi implementation into VB, maintaining the same output and logic.
program EnvironmentVariable; uses SysUtils; begin WriteLn('Temp = ' + GetEnvironmentVariable('TEMP')); end.
Debug.Print Environ$("PATH")
Maintain the same structure and functionality when rewriting this code in Go.
program EnvironmentVariable; uses SysUtils; begin WriteLn('Temp = ' + GetEnvironmentVariable('TEMP')); end.
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Generate an equivalent C version of this Elixir code.
System.get_env("PATH")
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Convert the following code from Elixir to C#, ensuring the logic remains intact.
System.get_env("PATH")
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Transform the following Elixir implementation into C++, maintaining the same output and logic.
System.get_env("PATH")
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Ensure the translated Go code behaves exactly like the original Elixir snippet.
System.get_env("PATH")
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Convert this Erlang block to C, preserving its control flow and logic.
os:getenv( "HOME" ).
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Maintain the same structure and functionality when rewriting this code in C#.
os:getenv( "HOME" ).
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Convert this Erlang block to C++, preserving its control flow and logic.
os:getenv( "HOME" ).
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Write a version of this Erlang function in Go with identical behavior.
os:getenv( "HOME" ).
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Port the following code from F# to C with equivalent syntax and logic.
open System [<EntryPoint>] let main args = printfn "%A" (Environment.GetEnvironmentVariable("PATH")) 0
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Rewrite this program in C# while keeping its functionality equivalent to the F# version.
open System [<EntryPoint>] let main args = printfn "%A" (Environment.GetEnvironmentVariable("PATH")) 0
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Maintain the same structure and functionality when rewriting this code in C++.
open System [<EntryPoint>] let main args = printfn "%A" (Environment.GetEnvironmentVariable("PATH")) 0
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Preserve the algorithm and functionality while converting the code from F# to Java.
open System [<EntryPoint>] let main args = printfn "%A" (Environment.GetEnvironmentVariable("PATH")) 0
System.getenv("HOME") System.getenv()
Convert the following code from F# to Python, ensuring the logic remains intact.
open System [<EntryPoint>] let main args = printfn "%A" (Environment.GetEnvironmentVariable("PATH")) 0
import os os.environ['HOME']
Translate this program into VB but keep the logic exactly as in F#.
open System [<EntryPoint>] let main args = printfn "%A" (Environment.GetEnvironmentVariable("PATH")) 0
Debug.Print Environ$("PATH")
Preserve the algorithm and functionality while converting the code from F# to Go.
open System [<EntryPoint>] let main args = printfn "%A" (Environment.GetEnvironmentVariable("PATH")) 0
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Write the same algorithm in C as shown in this Factor implementation.
"HOME" os-env print
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Port the following code from Factor to C# with equivalent syntax and logic.
"HOME" os-env print
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Convert the following code from Factor to C++, ensuring the logic remains intact.
"HOME" os-env print
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Rewrite this program in Go while keeping its functionality equivalent to the Factor version.
"HOME" os-env print
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Produce a functionally identical C code for the snippet given in Forth.
s" HOME" getenv type
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Transform the following Forth implementation into C#, maintaining the same output and logic.
s" HOME" getenv type
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Write the same algorithm in C++ as shown in this Forth implementation.
s" HOME" getenv type
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Rewrite the snippet below in Go so it works the same as the original Forth code.
s" HOME" getenv type
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Translate this program into C# but keep the logic exactly as in Fortran.
program show_home implicit none character(len=32) :: home_val integer :: home_len integer :: stat call get_environment_variable('HOME', home_val, home_len, stat) if (stat == 0) then write(*,'(a)') 'HOME = '//trim(home_val) else write(*,'(a)') 'No HOME to go to end if end program show_home
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Keep all operations the same but rewrite the snippet in C++.
program show_home implicit none character(len=32) :: home_val integer :: home_len integer :: stat call get_environment_variable('HOME', home_val, home_len, stat) if (stat == 0) then write(*,'(a)') 'HOME = '//trim(home_val) else write(*,'(a)') 'No HOME to go to end if end program show_home
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Write a version of this Fortran function in C with identical behavior.
program show_home implicit none character(len=32) :: home_val integer :: home_len integer :: stat call get_environment_variable('HOME', home_val, home_len, stat) if (stat == 0) then write(*,'(a)') 'HOME = '//trim(home_val) else write(*,'(a)') 'No HOME to go to end if end program show_home
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Transform the following Fortran implementation into Go, maintaining the same output and logic.
program show_home implicit none character(len=32) :: home_val integer :: home_len integer :: stat call get_environment_variable('HOME', home_val, home_len, stat) if (stat == 0) then write(*,'(a)') 'HOME = '//trim(home_val) else write(*,'(a)') 'No HOME to go to end if end program show_home
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Please provide an equivalent version of this Fortran code in Java.
program show_home implicit none character(len=32) :: home_val integer :: home_len integer :: stat call get_environment_variable('HOME', home_val, home_len, stat) if (stat == 0) then write(*,'(a)') 'HOME = '//trim(home_val) else write(*,'(a)') 'No HOME to go to end if end program show_home
System.getenv("HOME") System.getenv()
Convert this Fortran block to Python, preserving its control flow and logic.
program show_home implicit none character(len=32) :: home_val integer :: home_len integer :: stat call get_environment_variable('HOME', home_val, home_len, stat) if (stat == 0) then write(*,'(a)') 'HOME = '//trim(home_val) else write(*,'(a)') 'No HOME to go to end if end program show_home
import os os.environ['HOME']
Can you help me rewrite this code in PHP instead of Fortran, keeping it the same logically?
program show_home implicit none character(len=32) :: home_val integer :: home_len integer :: stat call get_environment_variable('HOME', home_val, home_len, stat) if (stat == 0) then write(*,'(a)') 'HOME = '//trim(home_val) else write(*,'(a)') 'No HOME to go to end if end program show_home
$_ENV['HOME']
Change the following Groovy code into C without altering its purpose.
System.getenv().each { property, value -> println "$property = $value"}
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Rewrite this program in C# while keeping its functionality equivalent to the Groovy version.
System.getenv().each { property, value -> println "$property = $value"}
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Write the same algorithm in C++ as shown in this Groovy implementation.
System.getenv().each { property, value -> println "$property = $value"}
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Produce a functionally identical Go code for the snippet given in Groovy.
System.getenv().each { property, value -> println "$property = $value"}
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Port the following code from Haskell to C with equivalent syntax and logic.
import System.Environment main = do getEnv "HOME" >>= print getEnvironment >>= print
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Port the following code from Haskell to C++ with equivalent syntax and logic.
import System.Environment main = do getEnv "HOME" >>= print getEnvironment >>= print
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Translate this program into Go but keep the logic exactly as in Haskell.
import System.Environment main = do getEnv "HOME" >>= print getEnvironment >>= print
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Generate an equivalent C version of this Icon code.
procedure main(arglist) if *envars = 0 then envars := ["HOME", "TRACE", "BLKSIZE","STRSIZE","COEXPSIZE","MSTKSIZE", "IPATH","LPATH","NOERRBUF"] every v := !sort(envars) do write(v," = ",image(getenv(v))|"* not set *") end
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Rewrite the snippet below in C# so it works the same as the original Icon code.
procedure main(arglist) if *envars = 0 then envars := ["HOME", "TRACE", "BLKSIZE","STRSIZE","COEXPSIZE","MSTKSIZE", "IPATH","LPATH","NOERRBUF"] every v := !sort(envars) do write(v," = ",image(getenv(v))|"* not set *") end
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Port the provided Icon code into C++ while preserving the original functionality.
procedure main(arglist) if *envars = 0 then envars := ["HOME", "TRACE", "BLKSIZE","STRSIZE","COEXPSIZE","MSTKSIZE", "IPATH","LPATH","NOERRBUF"] every v := !sort(envars) do write(v," = ",image(getenv(v))|"* not set *") end
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Can you help me rewrite this code in Java instead of Icon, keeping it the same logically?
procedure main(arglist) if *envars = 0 then envars := ["HOME", "TRACE", "BLKSIZE","STRSIZE","COEXPSIZE","MSTKSIZE", "IPATH","LPATH","NOERRBUF"] every v := !sort(envars) do write(v," = ",image(getenv(v))|"* not set *") end
System.getenv("HOME") System.getenv()
Translate this program into Python but keep the logic exactly as in Icon.
procedure main(arglist) if *envars = 0 then envars := ["HOME", "TRACE", "BLKSIZE","STRSIZE","COEXPSIZE","MSTKSIZE", "IPATH","LPATH","NOERRBUF"] every v := !sort(envars) do write(v," = ",image(getenv(v))|"* not set *") end
import os os.environ['HOME']
Convert this Icon snippet to VB and keep its semantics consistent.
procedure main(arglist) if *envars = 0 then envars := ["HOME", "TRACE", "BLKSIZE","STRSIZE","COEXPSIZE","MSTKSIZE", "IPATH","LPATH","NOERRBUF"] every v := !sort(envars) do write(v," = ",image(getenv(v))|"* not set *") end
Debug.Print Environ$("PATH")
Generate a Go translation of this Icon snippet without changing its computational steps.
procedure main(arglist) if *envars = 0 then envars := ["HOME", "TRACE", "BLKSIZE","STRSIZE","COEXPSIZE","MSTKSIZE", "IPATH","LPATH","NOERRBUF"] every v := !sort(envars) do write(v," = ",image(getenv(v))|"* not set *") end
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Please provide an equivalent version of this J code in C.
2!:5'HOME'
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Write a version of this J function in C# with identical behavior.
2!:5'HOME'
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Write the same code in C++ as shown below in J.
2!:5'HOME'
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Port the provided J code into Go while preserving the original functionality.
2!:5'HOME'
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Translate the given Julia code snippet into C without altering its behavior.
@show ENV["PATH"] @show ENV["HOME"] @show ENV["USER"]
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Convert this Julia block to C#, preserving its control flow and logic.
@show ENV["PATH"] @show ENV["HOME"] @show ENV["USER"]
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Change the programming language of this snippet from Julia to C++ without modifying what it does.
@show ENV["PATH"] @show ENV["HOME"] @show ENV["USER"]
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Convert the following code from Julia to Go, ensuring the logic remains intact.
@show ENV["PATH"] @show ENV["HOME"] @show ENV["USER"]
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Please provide an equivalent version of this Lua code in C.
print( os.getenv( "PATH" ) )
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Convert this Lua snippet to C# and keep its semantics consistent.
print( os.getenv( "PATH" ) )
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Write the same algorithm in C++ as shown in this Lua implementation.
print( os.getenv( "PATH" ) )
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Write the same code in Go as shown below in Lua.
print( os.getenv( "PATH" ) )
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Rewrite the snippet below in C so it works the same as the original Mathematica code.
Environment["PATH"]
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Convert this Mathematica snippet to C# and keep its semantics consistent.
Environment["PATH"]
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Can you help me rewrite this code in C++ instead of Mathematica, keeping it the same logically?
Environment["PATH"]
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Produce a functionally identical Go code for the snippet given in Mathematica.
Environment["PATH"]
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Write a version of this MATLAB function in C with identical behavior.
getenv('HOME') getenv('PATH') getenv('USER')
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Produce a language-to-language conversion: from MATLAB to C#, same semantics.
getenv('HOME') getenv('PATH') getenv('USER')
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Preserve the algorithm and functionality while converting the code from MATLAB to C++.
getenv('HOME') getenv('PATH') getenv('USER')
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Please provide an equivalent version of this MATLAB code in Go.
getenv('HOME') getenv('PATH') getenv('USER')
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Convert the following code from Nim to C, ensuring the logic remains intact.
import os echo getEnv("HOME")
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Write a version of this Nim function in C# with identical behavior.
import os echo getEnv("HOME")
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Produce a language-to-language conversion: from Nim to C++, same semantics.
import os echo getEnv("HOME")
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Produce a language-to-language conversion: from Nim to Go, same semantics.
import os echo getEnv("HOME")
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Transform the following OCaml implementation into C, maintaining the same output and logic.
Sys.getenv "HOME"
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Port the following code from OCaml to C# with equivalent syntax and logic.
Sys.getenv "HOME"
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Preserve the algorithm and functionality while converting the code from OCaml to Go.
Sys.getenv "HOME"
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Port the following code from Perl to C with equivalent syntax and logic.
print $ENV{HOME}, "\n";
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Produce a language-to-language conversion: from Perl to C#, same semantics.
print $ENV{HOME}, "\n";
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Generate a C++ translation of this Perl snippet without changing its computational steps.
print $ENV{HOME}, "\n";
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Write the same code in Go as shown below in Perl.
print $ENV{HOME}, "\n";
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Keep all operations the same but rewrite the snippet in C.
$Env:Path
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Convert this PowerShell snippet to C# and keep its semantics consistent.
$Env:Path
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Change the programming language of this snippet from PowerShell to C++ without modifying what it does.
$Env:Path
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Transform the following PowerShell implementation into Go, maintaining the same output and logic.
$Env:Path
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Convert this R block to C, preserving its control flow and logic.
Sys.getenv("PATH")
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Write the same code in C# as shown below in R.
Sys.getenv("PATH")
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Please provide an equivalent version of this R code in C++.
Sys.getenv("PATH")
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Can you help me rewrite this code in Go instead of R, keeping it the same logically?
Sys.getenv("PATH")
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Convert the following code from Racket to C, ensuring the logic remains intact.
#lang racket (getenv "HOME")
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Rewrite this program in C# while keeping its functionality equivalent to the Racket version.
#lang racket (getenv "HOME")
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Translate the given Racket code snippet into C++ without altering its behavior.
#lang racket (getenv "HOME")
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }
Transform the following Racket implementation into Go, maintaining the same output and logic.
#lang racket (getenv "HOME")
package main import ( "fmt" "os" ) func main() { fmt.Println(os.Getenv("SHELL")) }
Please provide an equivalent version of this COBOL code in C.
IDENTIFICATION DIVISION. PROGRAM-ID. Environment-Vars. DATA DIVISION. WORKING-STORAGE SECTION. 01 home PIC X(75). PROCEDURE DIVISION. * ACCEPT home FROM ENVIRONMENT "HOME" DISPLAY home * DISPLAY "HOME" UPON ENVIRONMENT-NAME ACCEPT home FROM ENVIRONMENT-VALUE GOBACK .
#include <stdlib.h> #include <stdio.h> int main() { puts(getenv("HOME")); puts(getenv("PATH")); puts(getenv("USER")); return 0; }
Keep all operations the same but rewrite the snippet in C#.
IDENTIFICATION DIVISION. PROGRAM-ID. Environment-Vars. DATA DIVISION. WORKING-STORAGE SECTION. 01 home PIC X(75). PROCEDURE DIVISION. * ACCEPT home FROM ENVIRONMENT "HOME" DISPLAY home * DISPLAY "HOME" UPON ENVIRONMENT-NAME ACCEPT home FROM ENVIRONMENT-VALUE GOBACK .
using System; namespace RosettaCode { class Program { static void Main() { string temp = Environment.GetEnvironmentVariable("TEMP"); Console.WriteLine("TEMP is " + temp); } } }
Write the same algorithm in C++ as shown in this COBOL implementation.
IDENTIFICATION DIVISION. PROGRAM-ID. Environment-Vars. DATA DIVISION. WORKING-STORAGE SECTION. 01 home PIC X(75). PROCEDURE DIVISION. * ACCEPT home FROM ENVIRONMENT "HOME" DISPLAY home * DISPLAY "HOME" UPON ENVIRONMENT-NAME ACCEPT home FROM ENVIRONMENT-VALUE GOBACK .
#include <cstdlib> #include <cstdio> int main() { puts(getenv("HOME")); return 0; }