answersLogoWhite

0


Best Answer

Matrices have two diagonals: main diagonal and anti-diagonal. The main diagonal runs from top-left to bottom-right. For square matrix A:

// main diagonal:

for (size_t xy=0; xy<A.size(); ++xy)

cin >> A[xy][xy];

// anti-diagonal

for (size_t x = A.size()-1, y=0; y<A.size(); --x; ++y

cin >> A[x][y];

User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you enter only diagonal elements in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Using the periodic chart indicate the most common charge of elements. Type the correct answer then press Enter. (Include plus or - where necessary.)?

A+ (+2)


using one stroke make the number statement true 5 plus 5 plus 5550?

There is no statement: there is only an expression. But usually such questions are answered by putting a diagonal stroke through the "=" sign (if there is one), to make it "&acirc;&permil;&nbsp;".


How many Essential Elements 2000 Bb Clarinet Books do they have?

There are only two: Essential Elements 2000 Bb Clarinet Book 1 Plus DVD and Essential Elements 2000 Bb Clarinet Book 2 with CD.


What is elements plus compounds?

Answer Mixture.


Correct formula in singe stroke 5 plus 5 plus 5 equals 550?

Put a diagonal line through the equals sign to make it "does not equal".


How old do you have to be to enter xfactor?

16 plus...


What elements make up proteins and carbohydration?

Carbohydrates [note correct word or spelling] contain only carbon, hydrogen, and oxygen. Proteins contain all these elements plus nitrogen, and some proteins contain other elements, usually sulfur and/or phosphorus.


How do you find the length of the diagonal of cube if side is given?

diagonal can only be found if two sides are known, imagine if you only have one known side ,the other side could be of any length and therefore the diagonal could be any length. if two sides are known then use pythagoras, as the two sides make up the 'adjacent' and 'opposite' side of a right angled triangle e.g. side a=2, side b=4 side c is square root of 2x2 plus 4x4 i.e root of 4+ 16=20 which is approx 4.47


Which function is used to remove all elements from a map in c plus plus?

map.clear()


What elements make up amethyst?

Silicon and oxygen, plus a few trace elements.


Correct this formula with a single stroke 5 plus 5 plus equals 550?

Putting a top to bottom diagonal strike through the equals sign ( &acirc;&permil;&nbsp; ) makes the sum 5 plus 5 is unequal to 550.


What does shift plus enter do?

Trys to delete your family