473,383 Members | 1,717 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

kako stvoriti matricu???

pokusavam na ovaj nacin ali mi bas ne ide...niz1 i niz2 su ispravni, ali kad
pokusam od njih napraviti matricu 3X3 nesto krene krivo.
molim pomoc ako netko zna u cemu je problem
<script language="JavaScript">
var niz1=new Array();
var niz2=new Array();
var mat=new Array();
for(var i=0; i<3; i++){
for(var j=0; j<3; j++){
niz2[j]=j+i;
alert('drugi['+j+']= '+niz2[j]);
}
niz1[i]=i;
alert('prvi['+i+']= '+niz1[i]);
mat=[niz1,niz2];
}
for(var i=0; i<mat.length; i++){
for(var j=0; j<mat[i].length; j++){
alert('mat['+i+']['+j+']= '+mat[i][j]);
}
}
</script>
Jul 20 '05 #1
3 1808
riki wrote:
pokusavam na ovaj nacin ali mi bas ne ide...niz1 i niz2 su ispravni, ali kad
pokusam od njih napraviti matricu 3X3 nesto krene krivo.
molim pomoc ako netko zna u cemu je problem
<script language="JavaScript">
var niz1=new Array();
var niz2=new Array();
var mat=new Array();
for(var i=0; i<3; i++){
for(var j=0; j<3; j++){
niz2[j]=j+i;
alert('drugi['+j+']= '+niz2[j]);
}
niz1[i]=i;
alert('prvi['+i+']= '+niz1[i]);
mat=[niz1,niz2];
}
for(var i=0; i<mat.length; i++){
for(var j=0; j<mat[i].length; j++){
alert('mat['+i+']['+j+']= '+mat[i][j]);
}
}
</script>


Hmmmmmm... I am not sure what language you are speaking, but looking at
your code, I am guessing you want a 3x3 array, but cant figure out how
to do it...?

Try this...

var mat=new Array();
for(var i=0; i<3; i++)
{
niz = new Array();

for(var j=0; j<3; j++)
niz[j]=j+i;

mat[i]=niz;
}

for(var i=0; i<mat.length; i++)
for(var j=0; j<mat[i].length; j++)
alert('mat['+i+']['+j+']= '+mat[i][j]);
Jul 20 '05 #2
Brian Genisio wrote:
riki wrote:
pokusavam na ovaj nacin ali mi bas ne ide...niz1 i niz2 su ispravni,
ali kad pokusam od njih napraviti matricu 3X3 nesto krene krivo.
molim pomoc ako netko zna u cemu je problem


Hmmmmmm... I am not sure what language you are speaking, but looking
at your code, I am guessing you want a 3x3 array, but cant figure out
how to do it...?


Excellent guess, Brian!

He's speaking Croatian, BTW.

Berislav

--
If the Internet is a Marx Brothers movie, and Web, e-mail, and IRC are
Groucho, Chico, and Harpo, then Usenet is Zeppo.
Jul 20 '05 #3
i'm sorry...didn't saw to whitch group i've send this post...i've thought
that it's cro group...
sorry again and thanks for answer :)
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Joza | last post by:
U zadnje vrijeme dogada mi se nesto prilicno cudno i sad me malo to malo muci. Naime (mozda ce ovo zvucati malo glupo), no u zadnja 2 - 3 tjedna, mozda i vise zna se dogoditi da kad npr. pogledam...
2
by: Josip ©aban | last post by:
Daklem, vec dvije godine se bavim aktivno bazama na faksu i sada na poslu i dosad sam radio iskljucivo SQL Server 2000. Na poslu pocinje projekt na Oracle-u 10 i zanimala bi me knjiga koja bi me...
3
by: kec | last post by:
I want to create a script that prevent users of my form for typeing stupid things. Here is my script: <script language="JavaScript" type="text/JavaScript"> <!-- function provjera(s1, s2, s3, s4)...
1
by: mitola | last post by:
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <conio.h> struct oseba //struktura osebe , ki jo kasneje uporabljamo v datoteki { char ime; char priimek;
2
by: mitola | last post by:
#include <stdlib.h> #include <stdio.h> #include <string.h> struct oseba { char ime; char priimek; char ulica;
0
by: Born | last post by:
C H A R L I E P A L M I E R I F R E E M P 3 D O W N L O A D *Con Salsa y Sabor: Charlie Palmieri and Menique 0* 'Charlie Palmieri - Calor De Madre' (http://tinyurl.com/yskr4n) (8:00...
6
by: MM | last post by:
Hello users. I have a query that I can run and see the result on the grid on design time, but when i run the program i get the folowing message:ORA-00979: not a GROUP BY expression. When I run the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.