Respuesta :

Using the knowledge in computational language in C++ it is possible to write a code that ofstream fout;string str;cin>>str;fout.open(str);if the user enters the data myfile.txt as input when prompted.

Writting the code:

#include <iostream>

#include <exception>

using namespace std;

int main()

{

int x;

// make failbit to throw exception

cin.exceptions(ios::failbit);

try {

 cin >> x;

 cout << "input = " << x << endl;

}

catch(ios_base::failure &fb;) {

 cout << "Exception:" << fb.what() << endl;

 cin.clear();

}

return 0;

}

See more about C++ at brainly.com/question/18502436

#SPJ1

Ver imagen lhmarianateixeira