Question

I need to create a c++ print function that takes a vector of values ex: <1...

I need to create a c++ print function that takes a vector of values ex: <1 2 3 4 5 6> and prints it in the correct way with the given dimensions. Example 2x3 = [[1,2,3],[4,5,6]] or 3x2 = [[1,2],[3,4],[5,6]]. To make this even more difficult there can be 3 dimensional matrixs. For example for <1 2 3 4 5 6 7 8 9 10 11 12> with dimensions depthXheightXwidth: 2x3x2 = [[[1,2],[3,4],[5,6]],[[7,8],[9,10],[11,12]]]. The depth height and width could be any value as well as the numbers in the arrays so I need a function that can handle all cases. Any help would be greatly appreciated.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Well, this is actually quite a difficult problem as you want to handle all possible cases for any count of elements. And that

Add a comment
Know the answer?
Add Answer to:
I need to create a c++ print function that takes a vector of values ex: <1...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Q 3-) (30 points) Write a C program (MAIN function) and a FUNCTION to create and...

    Q 3-) (30 points) Write a C program (MAIN function) and a FUNCTION to create and print the transpose of a two- dimensional array. Within C program (the MAIN function); Declare a two- dimensional 3X2 integer array A and initialise with the values (1,2), (3,4), (5,6), declare also a two-dimensional 2X3 integer array B and initialise it with zero. Call the FUNCTION and pass arrays A and B to the FUNCTION as arguments. Print the array A and its transpose....

  • Please use C !!! Write a C function matrixTranspose that takes a two-dimensional array as its...

    Please use C !!! Write a C function matrixTranspose that takes a two-dimensional array as its input argument then transposes its elements and prints the results. Develop the matrixTranspose method with two different methods: 1. Assume the matrix is a square matrix. This will make finding the transpose a simple swapping of the arrays’ elements and it can be done in place. 2. Generalize your function to work with any NxM matrix where N≠M. You will need to properly handle...

  • Due to lack of time, I need help writing this c++ function and sample driver. I...

    Due to lack of time, I need help writing this c++ function and sample driver. I will add the description below. Any help would be greatly appreciated. Thank you. Write a function with two C++ strings as parameters void addS( const char origl], char plural]) The function will make a copy of orig to the C++ string The function will make a copy of orig to the C+t string plural with an 's at the end. A sample driver would...

  • I need to create a function that opens and reads in each line of a text...

    I need to create a function that opens and reads in each line of a text file and generates a graph based on a text file that has a node array in it for example, the array would be 1   2   3 (node 1 is connected to node 2 and 3)    2   1   5   6   7 (node 2 is connected to node 1,5,6, and 7)    3   1 (node 3 is connected to node 1)    4   5   6  ...

  • I need only one  C++ function . It's C++ don't write any other language. Hello I need...

    I need only one  C++ function . It's C++ don't write any other language. Hello I need unzip function here is my zip function below. So I need the opposite function unzip. Instructions: The next tools you will build come in a pair, because one (zip) is a file compression tool, and the other (unzip) is a file decompression tool. The type of compression used here is a simple form of compression called run-length encoding (RLE). RLE is quite simple: when...

  • Hey everyone, I need help making a function with this directions with C++ Language. Can you...

    Hey everyone, I need help making a function with this directions with C++ Language. Can you guys use code like printf and fscanf without iostream or fstream because i havent study that yet. Thanks. Directions: Write a function declaration and definition for the char* function allocCat. This function should take in as a parameter a const Words pointer (Words is a defined struct) The function should allocate exactly enough memory for the concatenation of all of the strings in the...

  • I need a c++ code that: 1- Read from a text file using C++ example: mytext.txt...

    I need a c++ code that: 1- Read from a text file using C++ example: mytext.txt 2- a function that adds three letters to each latter in that text file for example, if there is a "hello world" inside the text file the function will make it look like "habcezyeloiulghtoiuy wnfroewqrmnilkitduyt" if you note the first latter h follow with three letters abc the e follow with another three zye .... etc so the function is like hashing function that...

  • I need help implementing a few functions in c++. Any help would be appreciated 1. a...

    I need help implementing a few functions in c++. Any help would be appreciated 1. a function void PairsAddUpToK(int a[], int a_len, int k) that finds all pairs of numbers in an array that add up to a given number k 2. A function void TriplesAddUpToK(int a[], int a_len, int k) that finds all sets of three numbers in an array that ad up to a given number k 3. A function void SubsetsAddUpToK((int a[], int a_len, int k) that...

  • I am using C++ Write a program to determine if a gird follows the rules to...

    I am using C++ Write a program to determine if a gird follows the rules to be classified as a Lo Shu Magic Square. The Lo Shu Magic Square is a grid with 3 rows and 3 columns shown in figure below. The Lo Shu Magic Square has the following properties: The grid contains the numbers 1 through 9 exactly. The sum of each row, each column, and each diagonal all add up to the same number. This is shown...

  • I need only one  C++ function . It's C++ don't write any other language. Hello I need...

    I need only one  C++ function . It's C++ don't write any other language. Hello I need unzip function here is my zip function below. So I need the opposite function unzip. Instructions: The next tools you will build come in a pair, because one (zip) is a file compression tool, and the other (unzip) is a file decompression tool. The type of compression used here is a simple form of compression called run-length encoding (RLE). RLE is quite simple: when...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT