- Course
- Text Files B
- Convert a text file to uppercase
Convert a text file to uppercase
Last updated:
8/23/2020
⁃
Difficulty:
Intermediate
Write a program in C# to read a text file and make a copy in another file by changing the lowercase letters to uppercase.
Input
Output
Solution
- using System.IO;
- public class ConvertTextFileToUppercase
- {
- public static void Main(string[] args)
- {
- string inputFileName = "input.txt";
- string outputFileName = "output.txt";
-
- string contents = File.ReadAllText(inputFileName);
- contents = contents.ToUpper();
-
- File.WriteAllText(outputFileName, contents);
- }
- }