Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint
Cover Image
Cover Image
Drag to reposition
Contributed Answers

How to make the program sleep for x milliseconds in C++?

Answered on 2nd May, 2019, 0 Views

Here we will see how to sleep for x (given by user) milliseconds in C++ program. To do this thing we can use different libraries. But here we are using the clock() function. The clock() will return the current CPU time. Here we will try to find the ending time from the clock, and the given x value. Then for that amount of time, we will run one blank while loop to take the time. Here one mac.....

How do I generate random floats in C++?

Answered on 2nd May, 2019, 0 Views

In C or C++, we cannot create random float directly. We can create random floats using some trick. We will create two random integer values, then divide them to get random float value. Sometimes it may generate an integer quotient, so to reduce the probability of that, we are multiplying the result with some floating point constant like 0.5. , ,

How to execute a command and get output of command within C++ using POSIX?

Answered on 2nd May, 2019, 0 Views

Here we will see how to use the POSIX command through C++. The process is very simple, we have to use the function called system(). Inside this we have to pass string. That string will contain the POSIX command.  The syntax is like below. , , ,

When are Constructors Called in C++?

Answered on 2nd May, 2019, 0 Views

Here we will see, when constructors are called. Here constructors are of different types. Global, local, static local, dynamic. For the global object, the constructors are called before entering into the main function. , , When the object is non-static, then, constructor is called when the execution reaches the point, where object is created. , , When the object is local static, then only f.....

What happen when we exceed valid range of built-in data types in C++?

Answered on 2nd May, 2019, 0 Views

Here we will see what will be the results, if we exceed the range of built-in datatypes in C++. So let us see some examples. First one is the character type data. Here we are using a loop from 0 to 300, so it should print from 0 to 300, then stop. But it will generate one infinite loop. The character type data holds from -128 to 127. So after increasing from 127, it will be -128 again. So i.....

The feclearexcept in C++

Answered on 2nd May, 2019, 0 Views

The feclearexcept() function is used to clear the supported floating point exceptions represented by the excepts. This function returns 0, if all exceptions are cleared, or the exception value is 0. And returns nonzero value for some exceptions. To use this function, we have to enable the FENV_ACCESS. This will give our program to access the floating point environment to test the exception .....

static_cast in C++

Answered on 2nd May, 2019, 0 Views

The static_cast is used for the normal/ordinary type conversion. This is also the cast responsible for implicit type coercion and can also be called explicitly. You should use it in cases like converting float to int, char to int, etc. This can cast related type classes. , , If the types are not same it will generate some error. , ,

Advanced C++ with boost library

Answered on 2nd May, 2019, 0 Views

C++ boost libraries are widely useful library. This is used for different sections. It has large domain of applications. For example, using boost, we can use large number like 264 in C++. Here we will see some examples of boost library. We can use big integer datatype. We can use different datatypes like int128_t, int256_t, int1024_t etc. By using this we can get precision up to 1024 easily.....

transform() in C++

Answered on 2nd May, 2019, 0 Views

The transform function is present in the C++ STL. To use it, we have to include the algorithm header file. This is used to perform an operation on all elements. For an example if we want to perform square of each element of an array, and store it into other, then we can use the transform() function. The transform function works in two modes. These modes are − Unary operation modeBinar.....

What does buffer flush means in C++ ?

Answered on 2nd May, 2019, 0 Views

The buffer flush is used to transfer of computer data from one temporary storage area to computers permanent memory. If we change anything in some file, the changes we see on the screen are stored temporarily in a buffer. In C++, we can explicitly have flushed to force the buffer to be written. If we use std::endl, it adds one new line character, and also flush it. If this is not used, we c.....

loader
Advertisements
Contribution

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.