Answer:
#include <iostream>
#include <cstring>
#include <fstream>
using namespace std;
bool convertToUpper(const string &st);
int main()
{
string s;
cout << "Enter the string: " << endl;
getline(cin, s);
convertToUpper(s);
return 0;
}
bool convertToUpper(const string &st) {
if(st.length() == 0) {
return false;
} else {
ofstream myfile;
myfile.open ("Upper.txt");
for(int i=0;i<st.length();i++) {
if(st[i]>='a' && st[i]<='z') {
myfile << (char)toupper(st[i]);
} else {
myfile <<st[i];
}
}
myfile.close();
}
}