Absolute C++
6th Edition
ISBN: 9780133970784
Author: Walter Savitch, Kenrick Mock
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 2, Problem 13PP
Create a text file that contains 10 integers with one integer per line. You can enter any 10 integers that you like in the file. Then write a
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Please solve this using java
Write an application that allows a user to enter the names and birth dates of up to 10 friends. Continue to prompt the user for names and birth-dates until the user enters the sentinel value “ZZZ” for a name or has entered 10 names, whichever comes first.
When the user is finished entering names, produce a count of how many names were entered, and then display the names. In a loop, continuously ask the user to type one of the names and display the corresponding birth-date or an error message if the name has not been previously entered. The loop continues until the user enters “ZZZ” for a name.
Case - I: Playing with Digits
Write a program which reads input integers from input file which consists a series of numbers where each integer
contains only of the digits from 0 to 9.
SO 1. Count total digits in the number
SO 2. Count & Print the even digits
SO 3. Count & Print Odd Digits
SO 4. Showing how many times each digit appears in the integer.
Specifically if a is an integer is
countTotalDigits (a):// Returns total digits in integer
// Function to count & print even digitS
countEvens (a) ;
countodds (a) ;
// Function to count & print odd digits
countDigits (a) ;
// Function to count & print digits with stars
TTODIEMT
A straight line can be defined by a pair of points p1(x1, yı) and p2(x2, y2). The slope m of a line is defined
as follow:
У — Ул
x2 - x1
Your program reads the points from a text file called 'points.txt which contains the coordinates of
unknown number of pairs of points as shown in Figure 1. Each line contains four values x1, yl, x2, y2,
where x1, yl are the coordinates of the first point and x2, y2 are the coordinates of the second point.
m
10
-2
7.5
-3.2
4
15.5 -4.6
21
-2
12.5
Зр
5
2
-3
-6
10
3
10
15
Figure 1. Input file contains unknown number of point pairs
Use Spider, to create the following files:
(i)
The input file 'points.txt' shown in Figure 1.
(ii) Your Python program that reads from the input file 'points.txť, the coordinates of unknown
number of pairs of points, computes the corresponding slopes then prints the results on the
screen as shown in Figure 2.
-------
Line # x1
Y1
Y2
Slope
x2
1
10.00
-2.00
7.50
-3.20
0.48
2
4.00
15.50
-4.60
21.00
-0.64
3
0.00
0.00
e.00…
Chapter 2 Solutions
Absolute C++
Ch. 2 - It is difficult to make a budget that spans...Ch. 2 - You have just purchased a stereo system that cost...Ch. 2 - Suppose you can buy a chocolate bar from the...Ch. 2 - Write a program that finds and prints all of the...Ch. 2 - In cryptarithmetic puzzles, mathematical equations...Ch. 2 - Buoyancy is the ability of an object to float....Ch. 2 - Write a program that calculates the total grade...Ch. 2 - Write a program that finds the temperature, as an...Ch. 2 - (This is an extension of an exercise from Chapter...Ch. 2 - Create a text file that contains the text I hate...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Consider the following two relations for Millennium College: STUDENT(StudentID, StudentName, CampusAddress, GPA...
Modern Database Management
The contents of this type of file can be viewed in an editor such as Notepad. a. text file b. binary file c. En...
Starting Out with Python (4th Edition)
What are the advantages in implementing a language with a pure interpreter?
Concepts of Programming Languages (11th Edition)
Complete the following main function so that it asks for the user's weight (in pounds) and displays the equival...
Starting Out with C++: Early Objects (9th 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
- In python The text file “studentMarks.txt” has been provided for you. Each line contains the Last Name, First Name and 8 marks separated by spaces of a single student. For each student in the file, adjust the file to include the average of their top 6 marks, rounded to 1 decimal place, at the end of the line. For example, in the file, the line may say: Mars, Bruno 82 82 85 94 65 79 81 90 Afterwards, it should be updated to say: Mars, Bruno 82 82 85 94 65 79 81 90 Top6Avg: 85.7 Your program must define a function to determine the average of the top 6 marks. You may define more functions as needed for your program.arrow_forwardProgram in JAVA using While Loop Write a program that takes a positive integer input and prints the numbers starting from input until 0 in one line where each numbers are separated by a space. Note: There's an initial code prepared for you. Go directly to the code editor file and complete the solution. Input 1. A positive integer input Output Enter a number: 5 5 4 3 2 1 0arrow_forwardYour program should use a loop to read data from a text file which contains students' names and 3 exam scores. The program should calculate the exam average for each student, determine the appropriate letter grade for that exam average, and print the name, average, and letter grade. After printing all this, you need to print the count of the total number of A's, B's, C's, D's, and F's for the whole class. The text file you need to use can be accessed using this link: scores.txt. Copy this file to the folder where your program will reside. The text file contains a list of 30 records, and each record contains a name and that person's 3 test scores. Each field is separated by a tab character. The first 2 records looks like this: Davis 88 92 84Wilson 98 80 73 and so on. Your program will need to open this file and read each line until the end of file. I recommend calculating a student's exam average and letter grade as you read the file, although this is not a…arrow_forward
- JAVA PPROGRAM Write a program that prompts the user to enter a file name, then opens the file in text mode and reads names. The file contains one name on each line. The program then compares each name with the name that is at the end of the file in a symmetrical position. For example if the file contains 10 names, the name #1 is compared with name #10, name #2 is compared with name #9, and so on. If you find matches you should print the name and the line numbers where the match was found. While entering the file name, the program should allow the user to type quit to exit the program. If the file with a given name does not exist, then display a message and allow the user to re-enter the file name. The file may contain up to 100 names. You can use an array or ArrayList object of your choosing, however you can only have one array or ArrayList. Input validation: a) If the file does not exist, then you should display a message "File 'somefile.txt' is not found." and allow the…arrow_forwardA Personal Fitness Tracker is a wearable device that tracks your physical activity, calories burned, heart rate, sleeping patterns, and so on. One common physical activity that most of these devices track is the number of steps you take each day. The steps.txt file contains the number of steps a person has taken each day for a year. There are 365 lines in the file, and each line contains the number of steps taken during a day. (The first line is the number of steps taken on January 1st, the second line is the number of steps taken on January 2nd, and so forth.) Write a program that reads the file, then displays the average number of steps taken for each month. (The data is from a year that was not a leap year, so February has 28 days.) You don't need to see the file , Just write a code using the "file" like this def main(): with open("steps.txt", "r") as file:arrow_forward12 Digit Barcode In this homework, you will develop a python program which reads a series of barcodes from "barcodes.txt" and creates an output file "output.txt" which contains the barcodes and their status as seen in the example output below. 153182953420 5+1+2.5.4-1 7+3+8+4+3+2-3 1 23601057072 6+t-13 Even : 2+6+1 +5+0 = 14 Odd: 1+3+0+ 0 +7+7 = 18 3 x8 = 24 D+3- 10 4 + 4 = 8 10 -8 = 2 (CORRECT) What to submit: 1) ipynb file which contains checkBarcode function which takes a string varlable as input and returns true or false, and a driver program which reads in "barcodes.txt" and creates "output.txt". Assume the input file contains one barcode info per line. Important: Your input file name MUST BE "barcodes.txt" and the output file name MUST BE "output.txt". Otherwise, you'l get up to 30 pts penalty Below a sample output.txt: 123601057072 is a valid 10-digits barcode lab601057072 is an invalid 10-digits barcode 172601055072 is an invalid 10-digits barcode 12345 is an invalid 10-digits…arrow_forward
- Answer fast else downvotearrow_forwardwordSort.py: Write a program that reads words from a file (filename given as a command-line argument) and prints them in (case insensitive) sorted order. For example, if the input file contains:If there's a problem yo I'll solve itCheck out the hook while my DJ revolves itIce ice baby The program should print (one word per line, compressed here for brevity):a baby Check DJ hook I'll Ice ice If it it my outproblem revolves solve the there's while yoarrow_forwardPYTHON CODINGarrow_forward
- The program takes a single argument as the name of the file to be read. A sample file is named (Movies.txt). The program reads this file which has labeled columns separated by commas. Every row of this text file includes information about a movie. You are asked to read every row as a string and decompose the given information (separated by commas). If a costumer wants too see "List of the Genres" (or genre,score,year) all genres type must be show. I need this answer in C language. Please explain nicely. Thanks.arrow_forwardCode in Java - While Loop Write a program that takes an integer and prints the number of trailing zeroes. Trailing zeroes are the zeroes found at the right side of a number.arrow_forwardIf you have downloaded the source code from this book’s companion Web site, you will find a file named text.txt in the Chapter 08 folder. Write a program that reads the file’s contents and determines the following:• The number of uppercase letters in the file• The number of lowercase letters in the file• The number of digits in the file• The number of whitespace characters in the filearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
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