
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question

Transcribed Image Text:1 Goals
Use C++ to read data from a text file and create an array of numbers.
Use the C++ 'fstream' library functions to open, read and close a text file.
You can use the C++ 'iomanip' library to format your output and manage whitespace on your
input.
Graduate students must create and write the data to a new text file.
2 Your assignment is to create a program that does the following:
a. You will need to create a new file (you can do this in the file system – make it plain text) and
call it mydata.txt.
b. Put a column of numbers in the text file to read later. Pay attention to type – make them all
have decimal points. In repl.it, use the numbers in my file.
c. Based on the examples in the slides (L3) and the textbook, write a C++ program, include
'iostream' and 'fstream'. You might need 'iomanip'.
d. Your program should read the numbers from the file into an array and print the array to the
console in reverse order using a for loop.
e. Graduate Students must also print the output to a new text file called output.txt.
f. Follow Professional Standards: For details on how programming style, see the
Programming Style Guide. Put your name in your program block comment at the top. Use
logical variable names and function names – do not make me guess. Indent properly. Greet
the user with the name of the program, and your name. Indicate that the program ended
normally by saying Bye or thanking the user for using your program. Do not forget the block
comments for each function. Use in-line comments as required.
g. Optional Challenge for undergrads (required for Graduate Students):
i. Print the output to a new text file called output.txt for an extra point.
Due as shown in Canvas by 11:59 pm
Submitting your program in Repl.it
1. If you wrote this program using an IDE on your computer, copy the code and paste it into the white
code window on the upper left side of the Repl.it window.
Submitting your program in Repl.it
8. If you wrote this program using an IDE on your computer, copy the code and paste it into the main.cpp
file (see the list of files to the left).
9. Click the run button above the code, the output appears in the right side (black background).
10. On the left there is a checkmark, click this and choose Run Tests. When you run the tests you will see
either passed or failed and you will have the option to see how your program output is different from the
test.
Repl.it has an automated testing system that checks your program output against my solution.
Repl.it will show you where your output is not the same as what was expected (click the button). If the
differences are superficial, you can submit your program and I will give you the credit you earned.
However, it is not enough to match the output. If your program does not follow the requirements you
will not get full credit. Your program must have been programmed correctly (if I asked for a loop, I

Transcribed Image Text:Practice Program 4
expect you to have one), you should have comment blocks and in-line comments as needed, use clear
variable names that enhance code clarity, use variables of the correct type for each piece of data, etc.
See the Programming Style Guide for more information.
The submit button is in the upper right corner. You must submit for me to see your program.
Post in the Canvas discussion forum or email the TA or me for help.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 3 images

Knowledge Booster
Similar questions
- FileAttributes.c 1. Create a new C source code file named FileAttributes.c preprocessor 2. Include the following C libraries a. stdio.h b. stdlib.h c. time.h d. string.h e. dirent.h f. sys/stat.h 3. Function prototype for function printAttributes() main() 4. Write the main function to do the following a. Return type int b. Empty parameter list c. Declare a variable of data type struct stat to store the attribute structure (i.e. statBuff) d. Declare a variable of data type int to store an error code (i.e. err) e. Declare a variable of data type struct dirent as a pointer (i.e. de) f. Declare a variable of data type DIR as a pointer set equal to function call opendir() passing explicit text “.” as an argument to indicate the current directory (i.e. dr) g. If the DIR variable is equal to NULL do the following i. Output to the…arrow_forwardAll I need is the main.cpp file Programming Specifications: Task: Two files have been provided (wordcounter.h and wordcount.cpp). You must open a text file, read in each word until end of file, add each word to the WordCount library and print the report. Your program must request a filename of a text file that contains words to count. You must check to see if it is a valid file and issue an error message if not and request a new file name until a valid one is entered. You must have at least one function that either passes in a parameter and at least one function that returns a value. You can have a single routine that does both. You must declare the class object properly, use AddWord() to add the word to the catalog and use PrintSummary() to produce the output. Design Considerations: The file will contain only words (no punctuation or special characters) less than or equal to 13 letters. There will be no limit to the number of words. You must open the file and read each…arrow_forwardhow to output the contents of a file to the screen? also how to count the following items using c++ codearrow_forward
- Create a C++ Program to do the following: Create a .txt file with up to 10 double numbers. Then in your code, create an array to hold 10 doubles. Openthe file. Read each number from the file into a place in the array. Count how many numbers you read. Close thefile.Now, go through the data in the array twice. Don’t go through all 10 elements in the array, only the elementsfor which you have read data. On the first pass, calculate the average of the numbers in the array. (Calculate thetotal, divide by count, that is µ).On the second pass through the data, for each number you should calculate how far it is from the average(number - average), square that, and keep a sum of the squares, that is S.When you’re done, calculate the average of that sum of squares, A. The square root of that number, σ is yourstandard deviation.Print out the average µ and standard deviation σarrow_forwarduse c++ programing language. Read two integer number from an input file called input.txt, then add these two numbers , store it in a variable called TOTAL, find the difference of the two numbers , store it in Difference, find product to the two numbers , store it in a variable called Multiply, fine quotient of the two number call it Division, find modular division of them and store it in a variable called MUD.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY