Μηνιαία αρχεία: Απρίλιος 2017


VirtualBox on Windows: Stuck in capture mode as the keyboard does not have a right Ctrl button 1

Recently, we got a laptop that did not have a right Ctrl button and we found out after we started a VM with no Guest Additions installed.
Because of these two factors we could not escape the VM capture mode and return to the host OS.

To resolve the issue, we pressed Alt+Ctrl+Del to force the window to escape by entering that specialised Windows security screen and the hit Cancel.
Then, we went to the VirtualBox window and did the following procedure to change the button that allows you to escape the capture mode.

From the VirtualBox Window menu we went to: File –> Preferences –> Input and then clicked on the box next to HOST KEY COMBINATION and then typed the key we wanted to use.


C++ How to make cout not use scientific notation

To force cout to print numbers exactly as they are and prevent it from using the scientific notation, we can use the std::fixed I/O manipulator as follows

#include <iostream>

using namespace std;

int main()
{
    std::cout << "The number 0.0001 in fixed:      " << std::fixed << 0.0001 << endl
              << "The number 0.0001 in default:    " << std::defaultfloat << 0.0001 << endl;

    std::cout << "The number 1000000000.0 in fixed:      " << std::fixed << 1000000000.0 << endl
              << "The number 1000000000.0 in default:    " << std::defaultfloat << 1000000000.0 << endl;
return 0;
}

Output

The number 0.0001 in fixed:      0.000100
The number 0.0001 in default:    0.0001
The number 1000000000.0 in fixed:      1000000000.000000
The number 1000000000.0 in default:    1e+09