Create a file that contains your favorite movie quote. Use a text editor such as Notepad and save the file as Quote.txt. Copy the file contents and paste them into a word-processing program such as Word. Save the file as Quote.doc. Write an application that displays the sizes of the two files as well as the ratio of their sizes to each other. To discover a file's size, you can create a System.IO.FileInfo object using a statement such as the following, where FILE_NAME is a string that contains the name of the file:

FileInfo wordInfo = new FileInfo(FILE_NAME);

Recommended Answers

All 3 Replies

Are you issuing a challenge?

Are you issuing a challenge?

haha. No,i just starting learning C# and i cant figure out how to do this program let alone how to start it.

  • Create the two files as described.
  • Use FileInfo to get the the size of each file.
  • Display the file name and it's size.
  • Calculate the ratio of the sizes (either txt/doc or doc/txt, your choice). Be aware that int/int will not result in a good ratio, so convert the values to doubles first.
  • Display the ratio, making sure you tell which of the above you choose.

It's about 6 lines of code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.