Skip to content

Tag: c++

C compatible printf output for Java

I’d want to convert float/double to string, in Java and C, such that the outputs are both consistent and user friendly. By “user friendly”, I mean the string should be human readable and sound: a maximum number of significant digits, and some automatic switching to scientific notation when a…

C# and Java DES Encryption value are not identical

I am trying to encrypt the same data using C# and Java. If the data is more than 7 bytes then Java and C#’s encrypted value are not identical. Input 1: a java output: FrOzOp/2Io8= C# output: FrOzOp/2Io8= Input 2: abc j : H9A/ahl8K7I= c#: H9A/ahl8K7I= Input 3: aaaaaaaa (Problem) j : Gxl7e0aWPd7j6l7uIEuMx…

Heap allocation and suitable hardware

For a C# .net 3.5 application which unavoidably creates a lot of data on the heap, in terms of hardware what would I be looking for in terms of memory? Would it just be the largest socket bus width? Or the “bandwidth” of the memory sticks? Or the actual frequency they run at? We have concluded the…

Difference between namespace in C# and package in Java

What is the difference (in terms of use) between namespaces in C# and packages in Java? Answer From: http://www.javacamp.org/javavscsharp/namespace.html Java Packages are used to organize files or public types to avoid type conflicts. Package constructs can be mapped to a file system. may be replaced: There i…

C++ equivalent to Java this

In Java you can refer to the current object by doing: this.x = x. How do you do this in C++? Assume that each of these code examples are part of a class called Shape. Java: C++: Answer Same word: this Only difference is it is a pointer, so you need to use the -> operator:

codility absolute distinct count from an array

so i took the codility interview test yesterday and was informed today that i failed, unfortunately i wasnt given any other information by either codility nor the employer as to where i screwed up so i would appreciate some help in knowing where i went wrong. i know codility pays alot of emphasis on how fast …