I did a program that creates a file of a number in its decimal, hexadecimal and octal form:
int main()
{
    int i;
    cout << "Enter number" << endl;
    cin >> i;
    system("pause");
    CreateFile(i);
    ShowFile();
    return 0;
}
void CreateFile(int i)
{
    ofstream file("file.txt", ios::app);
    file << "--------------------------------\n";
    file << "Number in decimal is:" << i << "\n";
    file << hex << setiosflags(ios::uppercase);
    file << "Number in hex is:: " << i << "\n";
    file << dec << resetiosflags(ios::showbase);
    file << oct << setiosflags(ios::uppercase);
    file << "Number in octal is: " << i << "\n";
    file.close();
}
However I don't know how to read it in the console:
void showFile()
{
    int open;
    ifstream file("file.txt", ios::in);
    while (!file.eof() == false) {
        file >> open;
        cout << "The number is " << open << endl;
    }
}
How can I open it?
 
     
     
    