Write a
cin << |
with the corrected version
cin >> |
and each (incorrect) occurrence of
cout >> |
with the corrected version
cout << |
For an easier version, assume that there is always exactly one blank space between any occurrence of cin and a following <<, and similarly assume that there is always exactly one blank space between each occurrence of cout and a following >>.
For a harder version, allow for the possibility that there may be any number of blanks, even zero blanks, between cin and << and between cout and >>. In this harder case, the replacement corrected version has only one blank between the cin or cout and the following operator. The program to be corrected is in one file and the corrected version is output to a second file. Your program should define a function that is called with the input- and output-file streams as arguments.
If this is being done as a class assignment, obtain the file names from your instructor and ask your instructor whether you should do the easier version or the harder version.
(Hint: Even if you are doing the harder version, you will probably find it easier and quicker to first do the easier version and then modify your program so that it performs the harder task.)
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Starting Out with Java: Early Objects (6th Edition)
Introduction To Programming Using Visual Basic (11th Edition)
Starting Out with C++: Early Objects (9th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Concepts Of Programming Languages
- i want the solution in C++ language solution should setup the midnight time to 0, and then write out all the possibilities that can take place in finding the difference between hours and minutes 4.7: Time Machine Your time machine is capable of going forward in time up to 24 hours. The machine is configured to jump ahead in minutes. To enter the proper number of minutes into your machine, you would like a program that can take a start time (in hours, minutes, and a Boolean indicating AM or PM) and a future time (in hours, minutes, and a Boolean indicating AM or PM) and calculate the difference in minutes between the start and future time. A time is specified in your program with three variables: int hours, minutes; bool isAM; // You can also use a char, i.e. A or P for example, to represent 11:50 PM, you would store: hours = 11,minutes = 50, isAM = false or if using a char, hours = 11,minutes = 50, isAM = 'A' This means that you need six variables to store a start and future time.…arrow_forwardWrite a program for Fillowing cases beldi---7.arrow_forwardThe problem is from Introduction to Programming and Data Structures with C++, 4th edition Write a program that prompts the user to enter the number of students and each student’s name and score, and displays the name and score of the student with the highest score and the student with the second-highest score.Sample RunEnter the number of students: 5Enter a student name: SmithEnter a student score: 60Enter a student name: JonesEnter a student score: 96Enter a student name: PetersonEnter a student score: 85Enter a student name: GreenlawEnter a student score: 98Enter a student name: ZhangEnter a student score: 95Top two students:Greenlaw's score is 98.0Jones's score is 96.0arrow_forward
- Please read instructions and complete in C++. Show functions. Confused.arrow_forward1arrow_forwardhow to do this in in C++ Language Zodiac Sign Identifier - Ask the user's birth month and birth day and return the corresponding Zodiac Sign he/she belongs: Evaluate the user's birth month and day by checking the following: If born from, Mar 21 to Apr 19 - Aries Apr 20 to May 20 - Taurus May 21 to Jun 20 - Gemini Jun 21 to Jul 22 - Cancer Jul 23 to Aug 22 - Leo Aug 23 to Sep 22 - Virgo Sep 23 to Oct 22 - Libra Oct 23 to Nov 21 - Scorpio Nov 22 to Dec 21 - Sagittarius Dec 22 to Jan 19 - Capricorn Jan 20 to Feb 18 - Aquarius Feb 19 to Mar 20 - Pisces Example: What is your month of birth? 1 - January (31 days) 2 - February (27 days, if Leap Year 28 days) 3 - March (31 days) 4 - April (30 days) 5 - May (31 days) 6 - June (30 days) 7 - July (31 days) 8 - August (31 days) 9 - September (30 days) 10 - October (31 days) 11 - November (30 days) 12 - December (31 days) Please enter your birth month: 8 Please enter day of your birth: 16 Please enter your year of birth: 1997 Your birthday is…arrow_forward
- Write a C++ program that includes the following function: a boolean function with the name of "evenorodd" that tests a number to see whether it is even or odd. your program should do the following in each iteration: ask the user to enter a number and each time by calling "evenorodd" function determines if the number is even or odd? then ask the user: "Do you want to continue?" if the answer is "Y" or "Yes", then repeat the processarrow_forwardin c++ In this exercise, we will read in a data file of employees (file is furnished to you, “employee.dat”): Employee SSN Employee Last Name Employee First Name Hours Worked Pay Per Hour Personal Income Tax Rate You assignment’s logic is to: Read in the records from the file, Pass the Hours Worked, Pay Per Hour, Personal Income Tax Rate to a single function to determine: Whether or not overtime pay is computed (anything over 40 hours is overtime at 1.5 times the regular pay). Compute any overtime pay at 1.5 times pay rate Compute the regular pay at regular hours (40 hours or less) Compute the gross pay (Regular Pay plus any overtime pay) Compute the personal income taxes withheld Compute Net Pay (gross pay minus personal income taxes withheld) Pass ALL these values BACK to the main calling routine from this one function. Display: the Employee SSN, Last Name, First Name, Total Hours, Regular Hours, Overtime Hours (if any), Pay Per Hour, Personal Income Tax Rate, Regular Pay,…arrow_forwardINSTRUCTIONS: Write a C++ script/code to do the given problems. MOVIE PROBLEM: Write a function that checks whether a person can watch an R18+ rated movie. One of the following two conditions is required for admittance: The person is atleast 18 years old. • They have parental supervision. The function accepts two parameters, age and isSupervised. Return a boolean. Example: acceptIntoMovie(14, true) → true acceptIntoMovie(14, false) → falsearrow_forward
- Code in C++ please, with comments to guide the code.arrow_forwardA parameter in a C++ function is passed by reference. Which of following statement is true?I. The reference of the real parameter is passed to the formal parameter; II. Changing the value of the formal parameter in the function will not change the real parameter; III. Changing the value of the formal parameter in the function will change the real parameter as well. Question options: a. I only b. II only c. I and II only d. I and III only Consider the following expression of integer operation in C++: int m = 15%6;int n = 15/6; What are the values of m and n? Question options: a. 3 2.5 b. 3 2 c. 2 2.5 d. 2.5 2.5 Consider an integer array a of length n with indexing starting at 0, where n is a positive integer. If the elements of the array a are to be written out in reverse order,…arrow_forwardThis question should be answered in C++ programming language. Please answer part 2 of this question as part 1 has already been answered through chegg. if GPA in the range of 2.5(inclusive) - 3:B if GPA in the range of 2(inclusive) - 2.5:C Less than 2: D > Print_Std_Info() : This function accepts the id of one student and prints out all the information of that student (all the attributes). Purpose: The purpose of this project is to allow you practice Object Oriented Design, Pointers, File /0, Exception Handling, Functions and Arrays. > Comapre_GPA(): This function compares the GPA of two students and returns the id of the student who has the higher GPA. Problem Objective: The objective of this problem is to create a fully functioning system that handles the records of students at Concordia University. Based on the following narrative, you need to come up with an Object-Oriented design to represent the different entities in the system. Part 2: Faculty Class: Assume the faculty of…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education