except that it would just be the variable 'name'. This means that you would need to append the file type to the end of the string before passing it as a parameter to the ifstream.open() method.
the string class will do this for you easily.
1 2 3 4 5 6
ifstream inFile; //notice here that the identifier and keyword have exchanged places.
string name;
cin>>name;
name+=".txt";
ifstream.open(name);