Instruction
stringlengths
45
106
input_code
stringlengths
1
13.7k
output_code
stringlengths
1
13.7k
Change the following Nim code into C without altering its purpose.
import times echo "Epoch for Posix systems: ", fromUnix(0).utc echo "Epoch for Windows system: ", fromWinTime(0).utc
#include <time.h> #include <stdio.h> int main() { time_t t = 0; printf("%s", asctime(gmtime(&t))); return 0; }
Convert this Nim block to C#, preserving its control flow and logic.
import times echo "Epoch for Posix systems: ", fromUnix(0).utc echo "Epoch for Windows system: ", fromWinTime(0).utc
using System; class Program { static void Main() { Console.WriteLine(new DateTime()); } }
Convert the following code from Nim to C#, ensuring the logic remains intact.
import times echo "Epoch for Posix systems: ", fromUnix(0).utc echo "Epoch for Windows system: ", fromWinTime(0).utc
using System; class Program { static void Main() { Console.WriteLine(new DateTime()); } }
Convert this Nim block to C++, preserving its control flow and logic.
import times echo "Epoch for Posix systems: ", fromUnix(0).utc echo "Epoch for Windows system: ", fromWinTime(0).utc
#include <iostream> #include <chrono> #include <ctime> int main() { std::chrono::system_clock::time_point epoch; std::time_t t = std::chrono::system_clock::to_time_t(epoch); std::cout << std::asctime(std::gmtime(&t)) << '\n'; return 0; }
Generate an equivalent C++ version of this Nim code.
import times echo "Epoch for Posix systems: ", fromUnix(0).utc echo "Epoch for Windows system: ", fromWinTime(0).utc
#include <iostream> #include <chrono> #include <ctime> int main() { std::chrono::system_clock::time_point epoch; std::time_t t = std::chrono::system_clock::to_time_t(epoch); std::cout << std::asctime(std::gmtime(&t)) << '\n'; return 0; }
Ensure the translated Java code behaves exactly like the original Nim snippet.
import times echo "Epoch for Posix systems: ", fromUnix(0).utc echo "Epoch for Windows system: ", fromWinTime(0).utc
import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; public class DateTest{ public static void main(String[] args) { Date date = new Date(0); DateFormat format = DateFormat.getDateTimeInstance(); format.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.p...
Rewrite the snippet below in Java so it works the same as the original Nim code.
import times echo "Epoch for Posix systems: ", fromUnix(0).utc echo "Epoch for Windows system: ", fromWinTime(0).utc
import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; public class DateTest{ public static void main(String[] args) { Date date = new Date(0); DateFormat format = DateFormat.getDateTimeInstance(); format.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.p...
Preserve the algorithm and functionality while converting the code from Nim to Python.
import times echo "Epoch for Posix systems: ", fromUnix(0).utc echo "Epoch for Windows system: ", fromWinTime(0).utc
>>> import time >>> time.asctime(time.gmtime(0)) 'Thu Jan 1 00:00:00 1970' >>>
Change the following Nim code into Python without altering its purpose.
import times echo "Epoch for Posix systems: ", fromUnix(0).utc echo "Epoch for Windows system: ", fromWinTime(0).utc
>>> import time >>> time.asctime(time.gmtime(0)) 'Thu Jan 1 00:00:00 1970' >>>
Rewrite the snippet below in VB so it works the same as the original Nim code.
import times echo "Epoch for Posix systems: ", fromUnix(0).utc echo "Epoch for Windows system: ", fromWinTime(0).utc
Sub Main() Debug.Print Format(0, "dd mmm yyyy hh:mm") End Sub
Write the same algorithm in VB as shown in this Nim implementation.
import times echo "Epoch for Posix systems: ", fromUnix(0).utc echo "Epoch for Windows system: ", fromWinTime(0).utc
Sub Main() Debug.Print Format(0, "dd mmm yyyy hh:mm") End Sub
Produce a language-to-language conversion: from Nim to Go, same semantics.
import times echo "Epoch for Posix systems: ", fromUnix(0).utc echo "Epoch for Windows system: ", fromWinTime(0).utc
package main import ("fmt"; "time") func main() { fmt.Println(time.Time{}) }
Convert this Nim snippet to Go and keep its semantics consistent.
import times echo "Epoch for Posix systems: ", fromUnix(0).utc echo "Epoch for Windows system: ", fromWinTime(0).utc
package main import ("fmt"; "time") func main() { fmt.Println(time.Time{}) }
Produce a functionally identical C code for the snippet given in OCaml.
open Unix let months = [| "January"; "February"; "March"; "April"; "May"; "June"; "July"; "August"; "September"; "October"; "November"; "December" |] let () = let t = Unix.gmtime 0.0 in Printf.printf "%s %d, %d\n" months.(t.tm_mon) t.tm_mday (1900 + t.tm_year)
#include <time.h> #include <stdio.h> int main() { time_t t = 0; printf("%s", asctime(gmtime(&t))); return 0; }
Generate an equivalent C version of this OCaml code.
open Unix let months = [| "January"; "February"; "March"; "April"; "May"; "June"; "July"; "August"; "September"; "October"; "November"; "December" |] let () = let t = Unix.gmtime 0.0 in Printf.printf "%s %d, %d\n" months.(t.tm_mon) t.tm_mday (1900 + t.tm_year)
#include <time.h> #include <stdio.h> int main() { time_t t = 0; printf("%s", asctime(gmtime(&t))); return 0; }
Produce a language-to-language conversion: from OCaml to C#, same semantics.
open Unix let months = [| "January"; "February"; "March"; "April"; "May"; "June"; "July"; "August"; "September"; "October"; "November"; "December" |] let () = let t = Unix.gmtime 0.0 in Printf.printf "%s %d, %d\n" months.(t.tm_mon) t.tm_mday (1900 + t.tm_year)
using System; class Program { static void Main() { Console.WriteLine(new DateTime()); } }
Port the provided OCaml code into C# while preserving the original functionality.
open Unix let months = [| "January"; "February"; "March"; "April"; "May"; "June"; "July"; "August"; "September"; "October"; "November"; "December" |] let () = let t = Unix.gmtime 0.0 in Printf.printf "%s %d, %d\n" months.(t.tm_mon) t.tm_mday (1900 + t.tm_year)
using System; class Program { static void Main() { Console.WriteLine(new DateTime()); } }
Port the provided OCaml code into C++ while preserving the original functionality.
open Unix let months = [| "January"; "February"; "March"; "April"; "May"; "June"; "July"; "August"; "September"; "October"; "November"; "December" |] let () = let t = Unix.gmtime 0.0 in Printf.printf "%s %d, %d\n" months.(t.tm_mon) t.tm_mday (1900 + t.tm_year)
#include <iostream> #include <chrono> #include <ctime> int main() { std::chrono::system_clock::time_point epoch; std::time_t t = std::chrono::system_clock::to_time_t(epoch); std::cout << std::asctime(std::gmtime(&t)) << '\n'; return 0; }
Write the same code in C++ as shown below in OCaml.
open Unix let months = [| "January"; "February"; "March"; "April"; "May"; "June"; "July"; "August"; "September"; "October"; "November"; "December" |] let () = let t = Unix.gmtime 0.0 in Printf.printf "%s %d, %d\n" months.(t.tm_mon) t.tm_mday (1900 + t.tm_year)
#include <iostream> #include <chrono> #include <ctime> int main() { std::chrono::system_clock::time_point epoch; std::time_t t = std::chrono::system_clock::to_time_t(epoch); std::cout << std::asctime(std::gmtime(&t)) << '\n'; return 0; }
Produce a functionally identical Java code for the snippet given in OCaml.
open Unix let months = [| "January"; "February"; "March"; "April"; "May"; "June"; "July"; "August"; "September"; "October"; "November"; "December" |] let () = let t = Unix.gmtime 0.0 in Printf.printf "%s %d, %d\n" months.(t.tm_mon) t.tm_mday (1900 + t.tm_year)
import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; public class DateTest{ public static void main(String[] args) { Date date = new Date(0); DateFormat format = DateFormat.getDateTimeInstance(); format.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.p...
Transform the following OCaml implementation into Java, maintaining the same output and logic.
open Unix let months = [| "January"; "February"; "March"; "April"; "May"; "June"; "July"; "August"; "September"; "October"; "November"; "December" |] let () = let t = Unix.gmtime 0.0 in Printf.printf "%s %d, %d\n" months.(t.tm_mon) t.tm_mday (1900 + t.tm_year)
import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; public class DateTest{ public static void main(String[] args) { Date date = new Date(0); DateFormat format = DateFormat.getDateTimeInstance(); format.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.p...
Produce a language-to-language conversion: from OCaml to Python, same semantics.
open Unix let months = [| "January"; "February"; "March"; "April"; "May"; "June"; "July"; "August"; "September"; "October"; "November"; "December" |] let () = let t = Unix.gmtime 0.0 in Printf.printf "%s %d, %d\n" months.(t.tm_mon) t.tm_mday (1900 + t.tm_year)
>>> import time >>> time.asctime(time.gmtime(0)) 'Thu Jan 1 00:00:00 1970' >>>
Keep all operations the same but rewrite the snippet in Python.
open Unix let months = [| "January"; "February"; "March"; "April"; "May"; "June"; "July"; "August"; "September"; "October"; "November"; "December" |] let () = let t = Unix.gmtime 0.0 in Printf.printf "%s %d, %d\n" months.(t.tm_mon) t.tm_mday (1900 + t.tm_year)
>>> import time >>> time.asctime(time.gmtime(0)) 'Thu Jan 1 00:00:00 1970' >>>
Transform the following OCaml implementation into VB, maintaining the same output and logic.
open Unix let months = [| "January"; "February"; "March"; "April"; "May"; "June"; "July"; "August"; "September"; "October"; "November"; "December" |] let () = let t = Unix.gmtime 0.0 in Printf.printf "%s %d, %d\n" months.(t.tm_mon) t.tm_mday (1900 + t.tm_year)
Sub Main() Debug.Print Format(0, "dd mmm yyyy hh:mm") End Sub
Change the programming language of this snippet from OCaml to VB without modifying what it does.
open Unix let months = [| "January"; "February"; "March"; "April"; "May"; "June"; "July"; "August"; "September"; "October"; "November"; "December" |] let () = let t = Unix.gmtime 0.0 in Printf.printf "%s %d, %d\n" months.(t.tm_mon) t.tm_mday (1900 + t.tm_year)
Sub Main() Debug.Print Format(0, "dd mmm yyyy hh:mm") End Sub
Ensure the translated Go code behaves exactly like the original OCaml snippet.
open Unix let months = [| "January"; "February"; "March"; "April"; "May"; "June"; "July"; "August"; "September"; "October"; "November"; "December" |] let () = let t = Unix.gmtime 0.0 in Printf.printf "%s %d, %d\n" months.(t.tm_mon) t.tm_mday (1900 + t.tm_year)
package main import ("fmt"; "time") func main() { fmt.Println(time.Time{}) }
Generate an equivalent Go version of this OCaml code.
open Unix let months = [| "January"; "February"; "March"; "April"; "May"; "June"; "July"; "August"; "September"; "October"; "November"; "December" |] let () = let t = Unix.gmtime 0.0 in Printf.printf "%s %d, %d\n" months.(t.tm_mon) t.tm_mday (1900 + t.tm_year)
package main import ("fmt"; "time") func main() { fmt.Println(time.Time{}) }
Port the following code from Pascal to C with equivalent syntax and logic.
Program ShowEpoch; uses SysUtils; begin Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', Now)); Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', 0)); end.
#include <time.h> #include <stdio.h> int main() { time_t t = 0; printf("%s", asctime(gmtime(&t))); return 0; }
Write a version of this Pascal function in C with identical behavior.
Program ShowEpoch; uses SysUtils; begin Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', Now)); Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', 0)); end.
#include <time.h> #include <stdio.h> int main() { time_t t = 0; printf("%s", asctime(gmtime(&t))); return 0; }
Port the provided Pascal code into C# while preserving the original functionality.
Program ShowEpoch; uses SysUtils; begin Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', Now)); Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', 0)); end.
using System; class Program { static void Main() { Console.WriteLine(new DateTime()); } }
Rewrite the snippet below in C# so it works the same as the original Pascal code.
Program ShowEpoch; uses SysUtils; begin Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', Now)); Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', 0)); end.
using System; class Program { static void Main() { Console.WriteLine(new DateTime()); } }
Write the same algorithm in C++ as shown in this Pascal implementation.
Program ShowEpoch; uses SysUtils; begin Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', Now)); Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', 0)); end.
#include <iostream> #include <chrono> #include <ctime> int main() { std::chrono::system_clock::time_point epoch; std::time_t t = std::chrono::system_clock::to_time_t(epoch); std::cout << std::asctime(std::gmtime(&t)) << '\n'; return 0; }
Produce a language-to-language conversion: from Pascal to C++, same semantics.
Program ShowEpoch; uses SysUtils; begin Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', Now)); Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', 0)); end.
#include <iostream> #include <chrono> #include <ctime> int main() { std::chrono::system_clock::time_point epoch; std::time_t t = std::chrono::system_clock::to_time_t(epoch); std::cout << std::asctime(std::gmtime(&t)) << '\n'; return 0; }
Please provide an equivalent version of this Pascal code in Java.
Program ShowEpoch; uses SysUtils; begin Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', Now)); Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', 0)); end.
import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; public class DateTest{ public static void main(String[] args) { Date date = new Date(0); DateFormat format = DateFormat.getDateTimeInstance(); format.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.p...
Keep all operations the same but rewrite the snippet in Java.
Program ShowEpoch; uses SysUtils; begin Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', Now)); Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', 0)); end.
import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; public class DateTest{ public static void main(String[] args) { Date date = new Date(0); DateFormat format = DateFormat.getDateTimeInstance(); format.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.p...
Convert this Pascal snippet to Python and keep its semantics consistent.
Program ShowEpoch; uses SysUtils; begin Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', Now)); Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', 0)); end.
>>> import time >>> time.asctime(time.gmtime(0)) 'Thu Jan 1 00:00:00 1970' >>>
Generate an equivalent Python version of this Pascal code.
Program ShowEpoch; uses SysUtils; begin Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', Now)); Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', 0)); end.
>>> import time >>> time.asctime(time.gmtime(0)) 'Thu Jan 1 00:00:00 1970' >>>
Translate the given Pascal code snippet into VB without altering its behavior.
Program ShowEpoch; uses SysUtils; begin Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', Now)); Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', 0)); end.
Sub Main() Debug.Print Format(0, "dd mmm yyyy hh:mm") End Sub
Generate an equivalent VB version of this Pascal code.
Program ShowEpoch; uses SysUtils; begin Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', Now)); Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', 0)); end.
Sub Main() Debug.Print Format(0, "dd mmm yyyy hh:mm") End Sub
Write the same algorithm in Go as shown in this Pascal implementation.
Program ShowEpoch; uses SysUtils; begin Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', Now)); Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', 0)); end.
package main import ("fmt"; "time") func main() { fmt.Println(time.Time{}) }
Generate an equivalent Go version of this Pascal code.
Program ShowEpoch; uses SysUtils; begin Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', Now)); Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', 0)); end.
package main import ("fmt"; "time") func main() { fmt.Println(time.Time{}) }
Port the following code from Perl to C with equivalent syntax and logic.
print scalar gmtime 0, "\n";
#include <time.h> #include <stdio.h> int main() { time_t t = 0; printf("%s", asctime(gmtime(&t))); return 0; }
Convert the following code from Perl to C, ensuring the logic remains intact.
print scalar gmtime 0, "\n";
#include <time.h> #include <stdio.h> int main() { time_t t = 0; printf("%s", asctime(gmtime(&t))); return 0; }
Convert this Perl block to C#, preserving its control flow and logic.
print scalar gmtime 0, "\n";
using System; class Program { static void Main() { Console.WriteLine(new DateTime()); } }
Maintain the same structure and functionality when rewriting this code in C#.
print scalar gmtime 0, "\n";
using System; class Program { static void Main() { Console.WriteLine(new DateTime()); } }
Rewrite this program in C++ while keeping its functionality equivalent to the Perl version.
print scalar gmtime 0, "\n";
#include <iostream> #include <chrono> #include <ctime> int main() { std::chrono::system_clock::time_point epoch; std::time_t t = std::chrono::system_clock::to_time_t(epoch); std::cout << std::asctime(std::gmtime(&t)) << '\n'; return 0; }
Please provide an equivalent version of this Perl code in C++.
print scalar gmtime 0, "\n";
#include <iostream> #include <chrono> #include <ctime> int main() { std::chrono::system_clock::time_point epoch; std::time_t t = std::chrono::system_clock::to_time_t(epoch); std::cout << std::asctime(std::gmtime(&t)) << '\n'; return 0; }
Port the provided Perl code into Java while preserving the original functionality.
print scalar gmtime 0, "\n";
import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; public class DateTest{ public static void main(String[] args) { Date date = new Date(0); DateFormat format = DateFormat.getDateTimeInstance(); format.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.p...
Write the same code in Java as shown below in Perl.
print scalar gmtime 0, "\n";
import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; public class DateTest{ public static void main(String[] args) { Date date = new Date(0); DateFormat format = DateFormat.getDateTimeInstance(); format.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.p...
Ensure the translated Python code behaves exactly like the original Perl snippet.
print scalar gmtime 0, "\n";
>>> import time >>> time.asctime(time.gmtime(0)) 'Thu Jan 1 00:00:00 1970' >>>
Maintain the same structure and functionality when rewriting this code in Python.
print scalar gmtime 0, "\n";
>>> import time >>> time.asctime(time.gmtime(0)) 'Thu Jan 1 00:00:00 1970' >>>
Produce a functionally identical Go code for the snippet given in Perl.
print scalar gmtime 0, "\n";
package main import ("fmt"; "time") func main() { fmt.Println(time.Time{}) }
Write the same algorithm in Go as shown in this Perl implementation.
print scalar gmtime 0, "\n";
package main import ("fmt"; "time") func main() { fmt.Println(time.Time{}) }
Translate the given PowerShell code snippet into C without altering its behavior.
[datetime] 0
#include <time.h> #include <stdio.h> int main() { time_t t = 0; printf("%s", asctime(gmtime(&t))); return 0; }
Change the programming language of this snippet from PowerShell to C without modifying what it does.
[datetime] 0
#include <time.h> #include <stdio.h> int main() { time_t t = 0; printf("%s", asctime(gmtime(&t))); return 0; }
Maintain the same structure and functionality when rewriting this code in C#.
[datetime] 0
using System; class Program { static void Main() { Console.WriteLine(new DateTime()); } }
Port the provided PowerShell code into C# while preserving the original functionality.
[datetime] 0
using System; class Program { static void Main() { Console.WriteLine(new DateTime()); } }
Port the following code from PowerShell to C++ with equivalent syntax and logic.
[datetime] 0
#include <iostream> #include <chrono> #include <ctime> int main() { std::chrono::system_clock::time_point epoch; std::time_t t = std::chrono::system_clock::to_time_t(epoch); std::cout << std::asctime(std::gmtime(&t)) << '\n'; return 0; }
Translate the given PowerShell code snippet into C++ without altering its behavior.
[datetime] 0
#include <iostream> #include <chrono> #include <ctime> int main() { std::chrono::system_clock::time_point epoch; std::time_t t = std::chrono::system_clock::to_time_t(epoch); std::cout << std::asctime(std::gmtime(&t)) << '\n'; return 0; }
Translate the given PowerShell code snippet into Java without altering its behavior.
[datetime] 0
import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; public class DateTest{ public static void main(String[] args) { Date date = new Date(0); DateFormat format = DateFormat.getDateTimeInstance(); format.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.p...
Convert this PowerShell block to Java, preserving its control flow and logic.
[datetime] 0
import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; public class DateTest{ public static void main(String[] args) { Date date = new Date(0); DateFormat format = DateFormat.getDateTimeInstance(); format.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.p...
Keep all operations the same but rewrite the snippet in Python.
[datetime] 0
>>> import time >>> time.asctime(time.gmtime(0)) 'Thu Jan 1 00:00:00 1970' >>>
Translate the given PowerShell code snippet into Python without altering its behavior.
[datetime] 0
>>> import time >>> time.asctime(time.gmtime(0)) 'Thu Jan 1 00:00:00 1970' >>>
Write a version of this R function in C with identical behavior.
> epoch <- 0 > class(epoch) <- class(Sys.time()) > format(epoch, "%Y-%m-%d %H:%M:%S %Z") [1] "1970-01-01 00:00:00 UTC"
#include <time.h> #include <stdio.h> int main() { time_t t = 0; printf("%s", asctime(gmtime(&t))); return 0; }
Change the following R code into C without altering its purpose.
> epoch <- 0 > class(epoch) <- class(Sys.time()) > format(epoch, "%Y-%m-%d %H:%M:%S %Z") [1] "1970-01-01 00:00:00 UTC"
#include <time.h> #include <stdio.h> int main() { time_t t = 0; printf("%s", asctime(gmtime(&t))); return 0; }
Generate a C# translation of this R snippet without changing its computational steps.
> epoch <- 0 > class(epoch) <- class(Sys.time()) > format(epoch, "%Y-%m-%d %H:%M:%S %Z") [1] "1970-01-01 00:00:00 UTC"
using System; class Program { static void Main() { Console.WriteLine(new DateTime()); } }
Port the provided R code into C# while preserving the original functionality.
> epoch <- 0 > class(epoch) <- class(Sys.time()) > format(epoch, "%Y-%m-%d %H:%M:%S %Z") [1] "1970-01-01 00:00:00 UTC"
using System; class Program { static void Main() { Console.WriteLine(new DateTime()); } }
Preserve the algorithm and functionality while converting the code from R to C++.
> epoch <- 0 > class(epoch) <- class(Sys.time()) > format(epoch, "%Y-%m-%d %H:%M:%S %Z") [1] "1970-01-01 00:00:00 UTC"
#include <iostream> #include <chrono> #include <ctime> int main() { std::chrono::system_clock::time_point epoch; std::time_t t = std::chrono::system_clock::to_time_t(epoch); std::cout << std::asctime(std::gmtime(&t)) << '\n'; return 0; }
Generate a C++ translation of this R snippet without changing its computational steps.
> epoch <- 0 > class(epoch) <- class(Sys.time()) > format(epoch, "%Y-%m-%d %H:%M:%S %Z") [1] "1970-01-01 00:00:00 UTC"
#include <iostream> #include <chrono> #include <ctime> int main() { std::chrono::system_clock::time_point epoch; std::time_t t = std::chrono::system_clock::to_time_t(epoch); std::cout << std::asctime(std::gmtime(&t)) << '\n'; return 0; }
Rewrite this program in Java while keeping its functionality equivalent to the R version.
> epoch <- 0 > class(epoch) <- class(Sys.time()) > format(epoch, "%Y-%m-%d %H:%M:%S %Z") [1] "1970-01-01 00:00:00 UTC"
import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; public class DateTest{ public static void main(String[] args) { Date date = new Date(0); DateFormat format = DateFormat.getDateTimeInstance(); format.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.p...
Port the provided R code into Java while preserving the original functionality.
> epoch <- 0 > class(epoch) <- class(Sys.time()) > format(epoch, "%Y-%m-%d %H:%M:%S %Z") [1] "1970-01-01 00:00:00 UTC"
import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; public class DateTest{ public static void main(String[] args) { Date date = new Date(0); DateFormat format = DateFormat.getDateTimeInstance(); format.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.p...
Convert this R snippet to Python and keep its semantics consistent.
> epoch <- 0 > class(epoch) <- class(Sys.time()) > format(epoch, "%Y-%m-%d %H:%M:%S %Z") [1] "1970-01-01 00:00:00 UTC"
>>> import time >>> time.asctime(time.gmtime(0)) 'Thu Jan 1 00:00:00 1970' >>>
Convert this R block to Python, preserving its control flow and logic.
> epoch <- 0 > class(epoch) <- class(Sys.time()) > format(epoch, "%Y-%m-%d %H:%M:%S %Z") [1] "1970-01-01 00:00:00 UTC"
>>> import time >>> time.asctime(time.gmtime(0)) 'Thu Jan 1 00:00:00 1970' >>>
Translate this program into VB but keep the logic exactly as in R.
> epoch <- 0 > class(epoch) <- class(Sys.time()) > format(epoch, "%Y-%m-%d %H:%M:%S %Z") [1] "1970-01-01 00:00:00 UTC"
Sub Main() Debug.Print Format(0, "dd mmm yyyy hh:mm") End Sub
Maintain the same structure and functionality when rewriting this code in VB.
> epoch <- 0 > class(epoch) <- class(Sys.time()) > format(epoch, "%Y-%m-%d %H:%M:%S %Z") [1] "1970-01-01 00:00:00 UTC"
Sub Main() Debug.Print Format(0, "dd mmm yyyy hh:mm") End Sub
Port the following code from R to Go with equivalent syntax and logic.
> epoch <- 0 > class(epoch) <- class(Sys.time()) > format(epoch, "%Y-%m-%d %H:%M:%S %Z") [1] "1970-01-01 00:00:00 UTC"
package main import ("fmt"; "time") func main() { fmt.Println(time.Time{}) }
Keep all operations the same but rewrite the snippet in Go.
> epoch <- 0 > class(epoch) <- class(Sys.time()) > format(epoch, "%Y-%m-%d %H:%M:%S %Z") [1] "1970-01-01 00:00:00 UTC"
package main import ("fmt"; "time") func main() { fmt.Println(time.Time{}) }
Rewrite the snippet below in C so it works the same as the original Racket code.
#lang racket (require racket/date) (date->string (seconds->date 0 #f))
#include <time.h> #include <stdio.h> int main() { time_t t = 0; printf("%s", asctime(gmtime(&t))); return 0; }
Rewrite the snippet below in C so it works the same as the original Racket code.
#lang racket (require racket/date) (date->string (seconds->date 0 #f))
#include <time.h> #include <stdio.h> int main() { time_t t = 0; printf("%s", asctime(gmtime(&t))); return 0; }
Generate an equivalent C# version of this Racket code.
#lang racket (require racket/date) (date->string (seconds->date 0 #f))
using System; class Program { static void Main() { Console.WriteLine(new DateTime()); } }
Maintain the same structure and functionality when rewriting this code in C#.
#lang racket (require racket/date) (date->string (seconds->date 0 #f))
using System; class Program { static void Main() { Console.WriteLine(new DateTime()); } }
Port the provided Racket code into C++ while preserving the original functionality.
#lang racket (require racket/date) (date->string (seconds->date 0 #f))
#include <iostream> #include <chrono> #include <ctime> int main() { std::chrono::system_clock::time_point epoch; std::time_t t = std::chrono::system_clock::to_time_t(epoch); std::cout << std::asctime(std::gmtime(&t)) << '\n'; return 0; }
Write the same algorithm in C++ as shown in this Racket implementation.
#lang racket (require racket/date) (date->string (seconds->date 0 #f))
#include <iostream> #include <chrono> #include <ctime> int main() { std::chrono::system_clock::time_point epoch; std::time_t t = std::chrono::system_clock::to_time_t(epoch); std::cout << std::asctime(std::gmtime(&t)) << '\n'; return 0; }
Transform the following Racket implementation into Java, maintaining the same output and logic.
#lang racket (require racket/date) (date->string (seconds->date 0 #f))
import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; public class DateTest{ public static void main(String[] args) { Date date = new Date(0); DateFormat format = DateFormat.getDateTimeInstance(); format.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.p...
Convert this Racket block to Java, preserving its control flow and logic.
#lang racket (require racket/date) (date->string (seconds->date 0 #f))
import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; public class DateTest{ public static void main(String[] args) { Date date = new Date(0); DateFormat format = DateFormat.getDateTimeInstance(); format.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.p...
Write a version of this Racket function in Python with identical behavior.
#lang racket (require racket/date) (date->string (seconds->date 0 #f))
>>> import time >>> time.asctime(time.gmtime(0)) 'Thu Jan 1 00:00:00 1970' >>>
Produce a language-to-language conversion: from Racket to Python, same semantics.
#lang racket (require racket/date) (date->string (seconds->date 0 #f))
>>> import time >>> time.asctime(time.gmtime(0)) 'Thu Jan 1 00:00:00 1970' >>>
Can you help me rewrite this code in VB instead of Racket, keeping it the same logically?
#lang racket (require racket/date) (date->string (seconds->date 0 #f))
Sub Main() Debug.Print Format(0, "dd mmm yyyy hh:mm") End Sub
Keep all operations the same but rewrite the snippet in VB.
#lang racket (require racket/date) (date->string (seconds->date 0 #f))
Sub Main() Debug.Print Format(0, "dd mmm yyyy hh:mm") End Sub
Convert this Racket block to Go, preserving its control flow and logic.
#lang racket (require racket/date) (date->string (seconds->date 0 #f))
package main import ("fmt"; "time") func main() { fmt.Println(time.Time{}) }
Change the programming language of this snippet from Racket to Go without modifying what it does.
#lang racket (require racket/date) (date->string (seconds->date 0 #f))
package main import ("fmt"; "time") func main() { fmt.Println(time.Time{}) }
Translate this program into C but keep the logic exactly as in COBOL.
IDENTIFICATION DIVISION. PROGRAM-ID. epoch. DATA DIVISION. WORKING-STORAGE SECTION. 01 epoch-date. 03 year PIC 9(4). 03 month PIC 99. 03 dday PIC 99. PROCEDURE DIVISION. MOVE FUNCTION ...
#include <time.h> #include <stdio.h> int main() { time_t t = 0; printf("%s", asctime(gmtime(&t))); return 0; }
Convert this COBOL snippet to C and keep its semantics consistent.
IDENTIFICATION DIVISION. PROGRAM-ID. epoch. DATA DIVISION. WORKING-STORAGE SECTION. 01 epoch-date. 03 year PIC 9(4). 03 month PIC 99. 03 dday PIC 99. PROCEDURE DIVISION. MOVE FUNCTION ...
#include <time.h> #include <stdio.h> int main() { time_t t = 0; printf("%s", asctime(gmtime(&t))); return 0; }
Translate the given COBOL code snippet into C# without altering its behavior.
IDENTIFICATION DIVISION. PROGRAM-ID. epoch. DATA DIVISION. WORKING-STORAGE SECTION. 01 epoch-date. 03 year PIC 9(4). 03 month PIC 99. 03 dday PIC 99. PROCEDURE DIVISION. MOVE FUNCTION ...
using System; class Program { static void Main() { Console.WriteLine(new DateTime()); } }
Can you help me rewrite this code in C# instead of COBOL, keeping it the same logically?
IDENTIFICATION DIVISION. PROGRAM-ID. epoch. DATA DIVISION. WORKING-STORAGE SECTION. 01 epoch-date. 03 year PIC 9(4). 03 month PIC 99. 03 dday PIC 99. PROCEDURE DIVISION. MOVE FUNCTION ...
using System; class Program { static void Main() { Console.WriteLine(new DateTime()); } }
Produce a functionally identical C++ code for the snippet given in COBOL.
IDENTIFICATION DIVISION. PROGRAM-ID. epoch. DATA DIVISION. WORKING-STORAGE SECTION. 01 epoch-date. 03 year PIC 9(4). 03 month PIC 99. 03 dday PIC 99. PROCEDURE DIVISION. MOVE FUNCTION ...
#include <iostream> #include <chrono> #include <ctime> int main() { std::chrono::system_clock::time_point epoch; std::time_t t = std::chrono::system_clock::to_time_t(epoch); std::cout << std::asctime(std::gmtime(&t)) << '\n'; return 0; }
Preserve the algorithm and functionality while converting the code from COBOL to C++.
IDENTIFICATION DIVISION. PROGRAM-ID. epoch. DATA DIVISION. WORKING-STORAGE SECTION. 01 epoch-date. 03 year PIC 9(4). 03 month PIC 99. 03 dday PIC 99. PROCEDURE DIVISION. MOVE FUNCTION ...
#include <iostream> #include <chrono> #include <ctime> int main() { std::chrono::system_clock::time_point epoch; std::time_t t = std::chrono::system_clock::to_time_t(epoch); std::cout << std::asctime(std::gmtime(&t)) << '\n'; return 0; }
Convert this COBOL snippet to Java and keep its semantics consistent.
IDENTIFICATION DIVISION. PROGRAM-ID. epoch. DATA DIVISION. WORKING-STORAGE SECTION. 01 epoch-date. 03 year PIC 9(4). 03 month PIC 99. 03 dday PIC 99. PROCEDURE DIVISION. MOVE FUNCTION ...
import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; public class DateTest{ public static void main(String[] args) { Date date = new Date(0); DateFormat format = DateFormat.getDateTimeInstance(); format.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.p...
Rewrite this program in Java while keeping its functionality equivalent to the COBOL version.
IDENTIFICATION DIVISION. PROGRAM-ID. epoch. DATA DIVISION. WORKING-STORAGE SECTION. 01 epoch-date. 03 year PIC 9(4). 03 month PIC 99. 03 dday PIC 99. PROCEDURE DIVISION. MOVE FUNCTION ...
import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; public class DateTest{ public static void main(String[] args) { Date date = new Date(0); DateFormat format = DateFormat.getDateTimeInstance(); format.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.p...
Transform the following COBOL implementation into Python, maintaining the same output and logic.
IDENTIFICATION DIVISION. PROGRAM-ID. epoch. DATA DIVISION. WORKING-STORAGE SECTION. 01 epoch-date. 03 year PIC 9(4). 03 month PIC 99. 03 dday PIC 99. PROCEDURE DIVISION. MOVE FUNCTION ...
>>> import time >>> time.asctime(time.gmtime(0)) 'Thu Jan 1 00:00:00 1970' >>>