C++

08/25/19

Why does C++ not have reflection?

This is a somewhat bizarre question. My objectives are to understand the language design decision and to identify the possibilities of reflection in C++. 1. Why C++ language committee did not go... more
C

05/08/19

size_t vs. uintptr_t?

The C standard guarantees that `size_t` is a type that can hold any array index. This means that, logically, `size_t` should be able to hold any pointer type. I've read on some sites that I found... more

05/08/19

How to create a polygon in JTS when we have list of coordinate?

We can create a LineString using coordinates list like this: Geometry g1 = new GeometryFactory().createLineString(coordinates); How can we create a polygon using coordinates list? Thanks in... more
C++

05/06/19

Which is better option to use for dividing an integer number by 2?

Which of the following techniques is the best option for dividing an integer by 2 and why?Technique 1: x = x >> 1;Technique 2: x = x / 2;Here `x` is an integer.
C++

05/06/19

What's the rationale for null terminated strings?

As much as I love C and C++, I can't help but scratch my head at the choice of null terminated strings:* Length prefixed (i.e. Pascal) strings existed before C* Length prefixed strings make several... more
C++

05/01/19

unsigned int vs. size_t?

I notice that modern C and C++ code seems to use `size_t` instead of `int`/`unsigned int` pretty much everywhere - from parameters for C string functions to the STL. I am curious as to the reason... more
C

04/30/19

Why does this for loop exit on some platforms and not on others?

I have recently started to learn C and I am taking a class with C as the subject. I'm currently playing around with loops and I'm running into some odd behaviour which I don't know how to explain. ... more

04/27/19

Dynamic Programming and Knapsack Application?

Im studying dynamic programming and am looking to solve the following problem, which can be found here http://www.cs.berkeley.edu/~vazirani/algorithms/chap6.pdf: You are given a rectangular piece... more

04/24/19

How to calculate the area of a java.awt.geom.Area?

I am looking for a way to calculate the area, in pixels, of an arbitrary instance of `java.awt.geom.Area`. The background: I have `Shape`s in my applications that may overlap. I want to know how... more

Explain when you would use a while loop rather than a for loop and vice versa. Provide an example of one such instance.

Explain when you would use a while loop rather than a for loop and vice versa. Provide an example of one such instance. How are looping statements different from selection statements?

02/25/14

can anyone tell me why this has errors?

For your assignment you are writing a number guessing game; with a twist. In your game, they are calculations where the user must guess the missing number(s). The Computer guesses a random... more

06/03/13

what is the inverse of f(x) = x^2 + 2 ?

Hi, I just need to find the inverse of f(x) = x^2 + 2. So, can you help me ?

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.