Starting Out With C++: Early Objects, Loose-leaf Edition (10th Edition)
10th Edition
ISBN: 9780135241004
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 13.3, Problem 13.13CP
Make the required changes to the following program so it writes its output to the file output.txt instead of to the screen.
#include <iostream>
using namespace std;
int main()
{
cout << "Today is the first day\n";
cout << "of the rest of your life.\n";
return 0;
}
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Can you please explain this part again?
Date::Date :day(1),month(1),year(2000)
{
}
Is it written this way? I am a little confused about how to write this portion at the start in the Date.cpp file, can you please rewrite this part more clearly?
Language: Pyhon.
Processing: Mode 3.54 (Jonathan Feinberg)
Please post sketch fle code.
Create a sketch named boston pass. This program will tell the user whether they passed a course or not Please read the entire question before starting.
Create the following variables using an appropriate name and datatype (do not name them first variable, etc.)
First variable: keeps track of the student mark (whole number)
Second variable: keeps track of a Boolean value indicating if the student passed
Third variable: keeps track of amount the student passed or failed by (whole number)
Create the following functions using appropriate names (do not name them first function, etc.)
First function: accepts one numeric value, purpose is to see if a student passed the course (50 or more), returns a true or false value.
Second function: accepts one numeric value, purpose is to see how much more or less than 50 the student received, returns the amount higher or lower
than 50.
Third function: accepts one…
(16) 6. You want to write a Java application that creates a while loop that runs until the user enters a 0 as input. Each time the while loop runs, it displays a menu of three choices as will be shown in the sample run
below. When the program reads in the user's choice, that choice should be read in as a String called choiceStr. Then, choiceStr should be converted into an int called choice by using the code below:
int choice Integer.parseInt(choiceStr);
If the user enters a 1 for choice == 1, the program will print "Choice 1" to the screen. If the user enters a 2 for choice == 2, the program will print "Choice 2" to the screen. Here is a sample run:
0 - to quit
1
to print Choice 1
2 to print Choice 2
Enter choice: 1
Choice 1
0 - to quit
1 to print
Choice 1
2 to print Choice 2
Enter choice: 1
Choice 1
0
to quit
1
to print Choice 1
2 to print Choice 2
Enter choice: 2
Choice 2
0 - to quit
1 to print Choice 1
2 to print Choice 2
Enter choice: 0
Chapter 13 Solutions
Starting Out With C++: Early Objects, Loose-leaf Edition (10th Edition)
Ch. 13.1 - Name three different C++ classes that can be used...Ch. 13.1 - Name three different C++ classes that can be used...Ch. 13.1 - What is the purpose of the second parameter to the...Ch. 13.1 - Why is it important for a program to close an open...Ch. 13.1 - Which file open flag causes all output to take...Ch. 13.1 - Which file open flag causes the contents of an...Ch. 13.1 - What happens if ios: :out is used by itself to...Ch. 13.1 - What happens if ios::out is used by itself to open...Ch. 13.1 - Write a sequence of C++ statements that reads in...Ch. 13.1 - Write a sequence of C++ statements that reads in...
Ch. 13.1 - Show how to use the constructor of the fstream...Ch. 13.1 - Consider two parallel arrays of the same size, one...Ch. 13.3 - Make the required changes to the following program...Ch. 13.3 - Describe the purpose of the eof member function.Ch. 13.3 - Assume the file input.txt contains the following...Ch. 13.3 - Describe the difference between reading a file...Ch. 13.3 - Describe the difference between the getline...Ch. 13.3 - Describe the purpose of the put member function.Ch. 13.3 - What will be stored in the file out.dat after the...Ch. 13.3 - The following program skeleton, when complete,...Ch. 13.5 - Write a short program that opens two files...Ch. 13.5 - How would the number 479 be stored in a text file?...Ch. 13.5 - Describe the differences between the write member...Ch. 13.5 - What arc the purposes of the two arguments needed...Ch. 13.5 - What are the purposes of the two arguments needed...Ch. 13.5 - Describe the relationship between fields and...Ch. 13.5 - Prob. 13.27CPCh. 13.7 - Describe the difference between the seekg and the...Ch. 13.7 - Describe the difference between the tellg and the...Ch. 13.7 - Describe the meaning of the following file access...Ch. 13.7 - What is the number of the first byte in a file?Ch. 13.7 - Briefly describe what each of the following...Ch. 13.7 - Describe the mode that each of the following...Ch. 13 - Prob. 1RQECh. 13 - Before a file can be used, it must first beCh. 13 - When a program is finished using a file, it shouldCh. 13 - The__________ header file is required for file I/O...Ch. 13 - Prob. 5RQECh. 13 - The_____________ file stream data type is for...Ch. 13 - The____________ file stream data type is for input...Ch. 13 - The ______ file stream data type is for output...Ch. 13 - Write a statement that defines a file stream...Ch. 13 - Write a statement that defines a file stream...Ch. 13 - Write a statement that defines a file stream...Ch. 13 - Write two statements that use the people file...Ch. 13 - Write two statements that use the pets file stream...Ch. 13 - Write two statements that use the places file...Ch. 13 - If a file fails to open, the file stream object...Ch. 13 - Write a program segment that defines a file stream...Ch. 13 - The same formatting techniques used with ______...Ch. 13 - The ______ member function reports when the end of...Ch. 13 - The ______ function reads a line of text from a...Ch. 13 - The _______ member function reads a single...Ch. 13 - The _____ member function writes a single...Ch. 13 - Prob. 22RQECh. 13 - Prob. 23RQECh. 13 - Prob. 24RQECh. 13 - In C++, _______ provide a convenient way to...Ch. 13 - The _______ member function writes raw binary data...Ch. 13 - The _______ member function reads raw binary data...Ch. 13 - The ______ operator is necessary if you pass...Ch. 13 - In _______ file access, the contents of the file...Ch. 13 - In _____ file access, the contents of a file may...Ch. 13 - The _______ member function moves a files read...Ch. 13 - The ______ member function moves a files write...Ch. 13 - The _______ member function returns a files...Ch. 13 - The _______ member function returns a files...Ch. 13 - The ______ mode flag causes an offset to be...Ch. 13 - The ______ mode flag causes an offset to be...Ch. 13 - The ______ mode flag causes an offset to he...Ch. 13 - A negative offset causes the files read or write...Ch. 13 - Give a pseudocode algorithm for determining the...Ch. 13 - Give a pseudocode algorithm for comparing two...Ch. 13 - Prob. 41RQECh. 13 - Suppose that you have two text files that contain...Ch. 13 - Each of the following programs or program segments...Ch. 13 - File Previewer Write a program that asks the user...Ch. 13 - File Display Program Write a program that asks the...Ch. 13 - Punch Line Write a program that reads and prints a...Ch. 13 - Tail of a File Write a program that asks the user...Ch. 13 - String Search Write a program that asks the user...Ch. 13 - Sentence Filter A program that processes an input...Ch. 13 - File Encryption Filter File encryption is the...Ch. 13 - File Decryption Filter Write a program that...Ch. 13 - Letter Frequencies The letter e is the most...Ch. 13 - Put It Back C++ input stream classes have two...Ch. 13 - Prob. 11PCCh. 13 - Insertion Sort on a File II Modify the program...Ch. 13 - Prob. 13PCCh. 13 - Prob. 14PCCh. 13 - Inventory Program Write a program that uses a...Ch. 13 - Inventory Program Write a program that uses a...Ch. 13 - Group Project 17. Customer Accounts This program...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Why is it easier to write a program in a high-level language than in machine language?
Starting Out with C++ from Control Structures to Objects (9th Edition)
Assuming that intNumber is an integer variable, what value will each of the following statements assign to it? ...
Starting Out With Visual Basic (7th Edition)
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th Edition)
What do you call a program that translates a high-level language program into a separate machine language progr...
Starting out with Visual C# (4th Edition)
What will the following program display? public class ReviewQuestion5 { public static void main(String[] args) ...
Starting Out with Java: From Control Structures through Objects (6th Edition)
What does the loop do in the sequential search algorithm? What happens when the value being searched for is fou...
Starting Out with Programming Logic and Design (4th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Click on the buttons below to view all parts of the assignment. 3 When reading data from a text file, it is common to see numbers such as 12,345, $20, or 195*. Write a function that cleans a string containing digits by removing any characters that are not a digit or a - sign. Then convert to an integer and return the result. 1 2 numbers.cpp 1 #include 2 #include 13 14 using namespace std; /** } Cleans a string containing an integer and converts it. @param number a string containing an integer and possibly extraneous */ int clean(string number) CodeCheck characters @return the value of the number inside the string Resetarrow_forwardarray is stored in an external txt file Programming must be in C language, and not use Break, pass, continue, goto or returnarrow_forwardProblem Definition Task. Your task is to develop a python program that reads input from text file and finds if the alphanumeric sequence in each line of the provided input file is valid for Omani car license plate. The rules for valid sequences for car plates in Oman are as follows: Each sequence is composed of 1 to 5 digits followed by one or two letters. Digits cannot start with 0, for instance, 00, 011, or 09 are not valid digit sequences. The following list are the only valid letter combinations: ['A','AA','AB','AD','AR','AM','AW",'AY"', 'B', BA','BB','BD',"BR','BM',"BW',"BY', 'D','DA','DD','DR','DW','DY', 'R','RA','RR','RM','RW','RY', 'S','SS', 'M','MA','MB','MM','MW','MY", "W',"WA',WB',"wW', Y,YA','YB','YD','YR','YW',YY] Program Input/Output. Your program should read input from a file named plates.txt and write lines with valid sequences to a file named valid.txt. Any line from the input file containing invalid sequence should be written to a file named invalid.txt. Each line…arrow_forward
- // Swap.cpp - This program determines the minimum and maximum of three values input by // the user and performs necessary swaps. // Input: Three int values. // Output: The numbers in numerical order. #include <iostream> using namespace std; int main() { // Declare variables int first = 0; // First number int second = 0; // Second number int third = 0; // Third number int temp; // Used to swap numbers const string SENTINEL = "done"; // Named constant for sentinel value string repeat; bool notDone = true; //loop control // Get user input cout << "Enter first number: "; cin >> first; cout << "Enter second number: "; cin >> second; cout << "Enter third number: "; cin >> third; while(notDone == true){ // Test to see if the first number is greater than the second number // Test to see if the second number is greater than the third number // Test to…arrow_forwardTranscribed Image Text Problem 3) Create a text file that contains the following information: John Doe 2005 124.80 36 Note that the fist line represents the name of the client, the second line represents the year in which the client started an account with this insurance company. The third line represent the monthly payment for the insurance. The fourth line represents the number of months left in the insurance policy. Write a C++ program that will read this file and will display the client's name, the number of years for which this client has been with the company, and the remaining amount they have to payarrow_forwardHi, c++ help Please see my code The code reads two numbers from a file and creates a dice which must be played a certain amount of times (dertimined by input file). The code must then output the results of the multiple dice rolls. For line 1 **the numbers in brackets are the results of the multiple dice roll while the last number is the sum of the throws for the first die As you can see for the first line everything adds up correctly as the results of the dice (in brackets) are summed up correctly (last number) For the second row and all other following rolls, the code adds the rolls of the new dice and the result of the previous sum to get the new sum. This should not happen, I want the sum of each rows to be displayed on the end of each line The correct code should be display **please don't output comment [2] - [4 ]-[5] - 11 //dice rolled 3 times and sum is 11 [1] - [1 ]-2 //dice rolled 2 times with sum 2arrow_forward
- Complete the concat program which opens and prints the files on the command line to the screen. cmdline.cpp #include #include using namespace std; 4 int main(int argc, char* argv[]) { 5 8 9 10 a1.txt Alice was beginning to get very tired of sitting by her sister on the 2 bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in 1. a2.txt book her sister was reading, but it had no pictures or conversations in it, 'and what is the use of a book,' thought Alice 'without pictures or 3 1. conversation?' a3.txt So she was considering in her own mind (as well as she could, for the hot day made her feel very sleepy and stupid), whether the pleasure 3 1 of making a daisy-chain would be worth the trouble of getting up and m1.txt 1 "And God created great whales." --GENESIS. m2.txt "Leviathan maketh a path to shine after him; One would think the deep 2 to be hoary." -- JOB. m3.txt "Now the Lord had prepared a…arrow_forwardProgram C Loop, pls help ASAP int getNum(); /*accepts input from the user.*/ void display(int num); /*prints the number pattern*/ ---------------------------------------------------------------------arrow_forwardC. Programming language: Python Share code and screenshot Write a python Program that will include the following: • It will read from the user (with the Input method) a string. The user will be able to enter whatever text he wants. • You should then read the string character by character and do the following If the character is any Latin character (lowercase or uppercase A-Z, a-z) you will print "READING ALPHABETIC CHARACTER *", where * is the character you read If the character is a number you will print "READING DIGIT *", where * is the digit read If the character is any other punctuation mark (or the space), you will print "READING SIMPLE CHARACTER *", where * is the character read • For prints please use f-stringarrow_forward
- Instruction: It should be a C++ PROGRAM INCLUDE THE HEADER FILE, MAIN CPP, AND BSTREE.CPP There is a real program developed by a computer company that reads a report ( running text ) and issues warnings on style and partially corrects bad style. You are to write a simplified version of this program with the following features: Statistics A statistical summary with the following information: Total number of words in the report Number of unique words Number of unique words of more than three letters Average word length Average sentence length An index (alphabetical listing) of all the unique words (see next page for a specific format) Style Warnings Issue a warning in the following cases: Word used too often: list each unique word of more than three letters if its usage is more than 5% of the total number of words of more than three letters Sentence length : write a warning message if the average sentence length is greater than 10 Word length : write a warning message if the…arrow_forward1 2 3 4 5 programming questions / 3. gets the maximum of four integers [Question Description] Write a program that gets the maximum of four integers. [Input Format] four integers [Output Format] one integer.(the integer is the maximum of the four integers) [Input Example] 3451 [Output Example) 5 Submit source files Choose file No file chosen submit Note: Programs can only be written in the C++ language. If there are multiple source files, compress them into a rar zip package submission. operation result code not yet submitted Speaking:arrow_forwardC Programming Write function checkHorizontal to count how many discs of the opposing player would be flipped, it should do the following a. Return type integer b. Parameter list i. int rowii. int col iii. char board[ROW][COL] iv. char playerCharc. If the square to the left or right is a space, stop checking d. If the square to the left or right is the same character as the player’s character, save that it was a flank, stop checking e. If the square to the left or right is not the same character as the player’s character, count the disc f. If the counted discs is greater than zero AND the player found their own character, return the counted discs, otherwise return ZERO Write function checkVertical to count how many discs of the opposing player would be flipped, it should do the following a. Return type integer b. Parameter list i. int rowii. int col iii. char board[ROW][COL] iv. char playerCharc. If the square above or below is a space, stop checking d. If the square above or below is…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C - File I/O; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=cEfuwpbGi1k;License: Standard YouTube License, CC-BY
file handling functions in c | fprintf, fscanf, fread, fwrite |; Author: Education 4u;https://www.youtube.com/watch?v=aqeXS1bJihA;License: Standard Youtube License