联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp2

您当前位置:首页 >> C/C++编程C/C++编程

日期:2021-02-18 10:28

PIC 10B Homework 3 Due Wednesday, Feb 17

Problem 1:

Using good coding practices, write a program that compares the contents of two “.txt” files

and then saves the properties of the files in another “Properties.txt” file. The properties of

the each file should include the name of the file, the number of characters, the number of

words, and a sentence stating if one file has more lines than the other or the same amount

of lines.

Your program should prompt the user for the name of the files. Use operator overloading

to write functions that compare both files by the amount of lines such that ( file1 >

file2 ) returns true if file1 contains more lines than file2 and false otherwise. Similarly

( file1 == file2 ) returns true if the files contain the same amount of lines.

Figure 1 shows a sample output for the given file1 and file2.

Figure 1: Homework 3 sample console, input files “JFMAbstract.txt” and “PhysicaDAbstract”,

and resulting output file “Properties.txt”

Due Wednesday, Feb 17 Homework 3 PIC 10B

Good Coding Practices:

? think about cross-platform. Don’t use Windows or Mac only commands. For example,

pause == cin.get() twice, write many \n vs. system(clear) or system(’cls).

? passing objects by reference & or const & when possible

? using field initializer list when possible in all constructors

Instructions for submission:

? Name your filse exactly hw3.cpp, textfile.h and textfile.cpp.

? You may not use #include "stdafx.h".

? Add code description in the comment at the beginning of the file.

A sample description may look like:

/*

PIC 10B 2A, Homework 1

Purpose: Tic-tac-toe game

Author: Hanqin Cai

Date: 10/10/2019

*/

? Submit your header files and source codes to CCLE in separate files. Only .h and .cpp

files should be uploaded.


版权所有:留学生编程辅导网 2018 All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。