Matrix initiation

D

damiaotomas

Hi I'm trying to write a c++ code in which I create a matrix (no
randomly), and compare every row of this matrix with a vector x in
order to find the distance of every row related to the vector.
Basicaly I want this matrix to be a vector of vectors. So in natural
language it woud be:





define N /number of element in a vector

define M / number of vectors





main

{



int i, E[N], X[N][M], mi[N]





/initialize vectors in X[N][M] and vector mi[N]

x[M]={ E, E[i+1]...........E[i+(N-1)]}

for (i = 0 ; i<N ; i++)

(enter %d element for vector E[%d]: N, i);

scanf ( %d, &E)





for (i = 0 ; i<N ; i++)

(enter %d element for vector mi[%d]: N, i);

scanf ( %d, &E)





/Loop to compare every vector in x[N][M] with mi[N]



d=X[j]-mi

.......................................................................-
....................



Hope you help me with this one because I've been trying hard.

Ps: The result should de a vector d with N elements.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top