Given an M × N matrix mat that has all of its elements initialized to 0, write a C++ code fragment to store 1's along mat's main diagonal while leaving all other entries unchanged.
Example:
1 0 0 0
0 1 0 0
0 0 1 0
for (int i = 0; i < M; ++i)
mat[i][i] = 1;
Computer Science & Information Technology
You might also like to view...
The SelectedItem property of a ListBox __________.
a. contains the index of the currently selected item b. contains the text of the currently selected item c. returns the location of the currently selected item d. returns -1 if no item is selected
Computer Science & Information Technology
Which of the following data types is not supported in python?
A - Numbers B - String C - List D - Slice
Computer Science & Information Technology
You can concatenate two strings with the plus (+) sign.
Answer the following statement true (T) or false (F)
Computer Science & Information Technology
?Businesses are not permitted to use formsto collect information about their customers.
Answer the following statement true (T) or false (F)
Computer Science & Information Technology