Reading and Writing to a file.

I want to modify my program so that the program asks me to input the name of the file for input and reads the string from that file, then asks me to input the name of the file where i want the output and outputs the changed string to that file.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  #include <iostream>
#include <string>

using namespace std;

int main()

{
	
	string word;
	
	cout<<"Please enter your word:";
	getline(cin,word);
	
	for(int n=0; n<word.length(); n++)
	{
		if(word[n]=='a')
		{ word[n]='A';
		}
		else if(word[n]=='e')
		{word[n]='E';
		}
		else if(word[n]=='i')
		{word[n]='I';
		}
		else if(word[n]=='o')
		{word[n]='O';
		}
		else if(word[n]=='U')
		{word[n]='E';
		}
	}
	cout <<word<<endl;
	return 0;
}
Topic archived. No new replies allowed.