#include <iostream>
#include <fstream>

using namespace std;

int main(int argc, char *argv[])

    int x ;
    char y[1000] ;
    char str[10];
    char op [5] ;

    cout << "Wait for input: ";
    // get input, if the input is not "open", wait for another input

    //Creates an instance of ofstream, and opens example.txt
    ofstream a_file ( "example.txt" );
    // Outputs to example.txt through a_file
    cout<<"type some numbers :";
    cin>> x ;
    a_file<<"number :" <<x ;
    cout<<"type some alphabet :";
    cin>> y ;
    a_file<<"alphabet: "<<y ;
     while (true) {
        cin >> op;
        if(strcmp(op, "open")== 0) break;
        else cout << endl << "Hint: open" << endl << "type again:" ;
    // Close the file stream explicitly
    //Opens for reading the file
    ifstream b_file ( "example.txt" );
    //Reads one string from the file
    b_file>> str;
    //Should output 'this'
    cout<< str <<"\n";
    FILE *fp;ss
    fp=fopen("G:\\ccc\\example.txt", "r");
the program in ms-dos type, it will ask the user to type some number and alphabet and save those things that typed by user into a certain folder(for my situation, the file location: G:\ccc. and the name is example.txt). The problems is i want the program open(for write or read) the file if the user type "open" and pressed enter. But it did not open anythings. Can somebody help me.

Thanks in advance.