
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
Can you please code this part of the code. In c++.
The input here is:
Example 1 of input and output
input11.txt
4
2 4 0 0
2 0 0 0
0 0 0 0
0 0 8 0
Command line:
merge input=input11.txt output=output11.txt
output11.txt
122

Transcribed Image Text:1) Input file
The input file will never empty. It always contains two parts:
a) A number k (k>0, k is an integer) stands for the size
(size=width=height) of the matrix.
b) A group of numbers a (a, >=0, a, is an integer, 1<=i<=k, 1<=j<=k),
stand for the cells of the matrix.
2) Output file
The output file contains the moves. It should not contain spaces in between
each direction number. If the input matrix cannot be merged to one number,
"Impossible" should be outputted (case sensitive).
3. The Rules and Operations
1) Create the matrix: By reading the input file, you should be able to create a
matrix filled with the numbers. Each number corresponds to one cell. After
reading the example 1 from below input11.txt, you should be able to create
a matrix as follow Table 1:
Table 1
4
8
2.
2.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps

Knowledge Booster
Similar questions
- In C++ coding please 13.4 Programming 4: Binary Conversion In this assignment you will read in a string of 0's and 1's, you will then convert this to its decimal integer value and print that value on a single line (ending with a newline). For example: INPUT:0010 OUTPUT:2arrow_forwardWrite a program in C++ code:arrow_forwardYou guys use AI tool to answer. Last time I found plagiarism and AI detection in my answer. Now If you will use these things I'll surely give multiple downvotes and will report ⚠️ sure.arrow_forward
- Write a program in C++ that finds the count of a number in a list of integers from a text file named input.txt. The output will be written to output.txt and will count up to the largest number in the list, displaying how many times each number appears. The program must first check if input.txt exists. The maximum, minimum, and total amount will be displayed. You must use functions for better organization and debugging. Add comments to your code thoroughly explaining the logic. Libraries you may use: #include , #include , #include , #include , #include , #include , #include You may use vectors, arrays, and searching & sorting methods Example: input.txt: 5, 2, 8, 3, 6, 8, 2, 7, 4 output.txt: 2:** (2) 3:* (1) 4:* (1) 5:* (1) 6:* (1) 7:* (1) 8:** (2) Max: 8 Min: 2 There are 9 numbers.arrow_forwardin the C++ version please suppose to have a score corresponding with probabilities at the end and do not use the count[] function. Please explain the detail when coding. DO NOT USE ARRAY. The game of Pig The game of Pig is a dice game with simple rules: Two players race to reach 100 points. Each turn, a player repeatedly rolls a die until either a 1 ("pig") is rolled or the player holds and scores the sum of the rolls (i.e. the turn total). At any time during a player's turn, the player is faced with two decisions: roll - if the player rolls 1: the player scores nothing and it becomes the opponents turn. 2 - 6: the number is added to the player's turn total and the player's turn continues. hold - The turn total is added to the player's score and it becomes the opponent's turn. This game is a game of probability. Players can use their knowledge of probabilities to make an educated game decision. Assignment specifications Hold-at-20 means that the player will choose to roll…arrow_forwardI am currently coding in C++, using Dev C++ application. I keep getting the error " 'null' was not declared in this scope." The line of code that it is refrencing is " std::srand(std::time(null));". I have no idea what is happening or how to fix it.arrow_forward
- Write in c++ pleasearrow_forwardWrite a program in C++ that finds the count of a number in a list of integers from a text file named input.txt. - The output will be written to ouput.txt and will count up to the largest number in the list and display how many times each number appears. - The program must first check if input.txt exists. - The maximum /minimum and total amount will be displayed. - You must use functions (the more functions you use, the easier it will be to debug). - Add comments to your code thoroughly explaining the logic. - Libraries you may use: #include <iostream>, #include <string>, #include <fstream>, #include <iomanip>, #include <cmath>, #include <vector>, #include <ctime> - You may use vectors, arrays, and searching & sorting methods Ex:arrow_forwardThis assignment will give you practice on basic C programming. You will implement a few Cprogramsarrow_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