Please review this code :#include <iostream>#include <fstream>using namespace std;int main(){    float height[4]={17.5,8.4,2.9,7.9};    ofstream file;    file.open(BINARY.DAT, ios::binary | ios::out);    file.write((char*)&height, sizeof(height));    for(int i=0;i<4;i++)    height[i]=1;    file.close();    ifstream file1;    file1.open(BINARY.DAT, ios::binary | ios::in);    file1.read((char*)&height, sizeof(height));    for(int i=0;i<4;i++)    {        cout<<height[i];    }    file1.close();    return 0;}                                                                                                                                                                                                                                                                                                                                           
Binary File Handling Program
c++;file
using namespace std is considered bad practice. So you want to get rid of that.Next, you should give you variables better names. file and file1 are somewhat descriptiveness. Both tell you that it's a file, but neither says what kind of file.Also check whether you were actually able to open the file. For example, the file could be write-only (and your file.write() works, but your file1.read() fails), read-only (and your file.write() fails, but your file1.read() works), or neither (and both fail).What's that 4, by the way? The number of elements in your height is a magic number. It might change at some point, and you have to update it throughout your program. That's error prone. It's somewhat fine for a small program like this, but in greater programs, you want to give that number a name (see above), something like HEIGHT_LENGTH. Same holds for BINARY.DAT. You don't want to accidentally use BINARY.Dar the second time.Last but not least: use C-style cast as a last resort. You're looking for a reinterpret_cast<char*>.By the way, if possible, keep the scope of your variables small:#include <iostream>#include <fstream>int main(){    float height[4] = {17.5,8.4,2.9,7.9};    // Write to the file:        {        std::ofstream output;        if(!output.open(BINARY.DAT, ios::binary | ios::out)){            std::cerr << could not open file!;            return 1;        }        output.write(reinterpret_cast<char*>(height), sizeof(height));        output.close(); // not actually necessary    }    // Set the value to 1 for testing purposes    for(int i = 0; i < 4; i++)     {        height[i] = 1;    }    // Read back from the file:    {        std::ifstream input;        if(!input.open(BINARY.DAT, ios::binary | ios::in)){            std::cerr << could not open file!;            return 2;        }        input.read(reinterpret_cast<char*>(height), sizeof(height));        input.close(); // not actually necessary    }    for(int i = 0; i < 4; i++)    {        std::cout << height[i] << ' ';    }    std::cout << std::endl;    return 0;}I've also added some whitespace. Keep in mind: you write code both for the machine and the human who's going to read that code later. That human might be you or your supervisor. Make sure that it's easy to read.