Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: please help me with this I don't know where is my problem.

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default please help me with this I don't know where is my problem.

    import java.swing.*;
    import java.math.*;
    public class KonvertoMatricenNeVektor {

    public static void main(String[] args)
    {int a =new Integer (JOptionPane.showInputDialog("Jepni numrin e rreshtave")).intValue();
    int b= new Integer(JOptionPane.showInputDialog("Jepni numrin e shtyllave")).intValue();
    int matrica [][]=new int [a][b];
    for(int i=0; i<b; i++)
    {for(int j=0; j<a; j++)
    matrica[i][j]=(int) ((int) Math.random()*10);
    vektor(matrica);}}
    public static void vektor(int[][]m)
    {int rr=0;
    int sh=0;
    for(int i=0;i<m.length;i++)
    { rr+=1;
    for(int j=0;j<m[i].length;j++)
    sh+=1;}
    int vektor[]=new int[rr*sh];
    int k=0;
    for(int i=0; i<m[i].length;i++)
    {k+=1;
    for(int j=0;j<m.length;j++)
    {vektor[k]=m[i][j];
    k+=1;}
    for(int a=0;a<vektor.length;a++)
    System.out.println(vektor[a]);}

    }


    }


  2. #2
    Junior Member
    Join Date
    Jan 2014
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: please help me with this I don't know where is my problem.

    Can you please format your code?
    Announcements - What's Wrong With My Code?

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: please help me with this I don't know where is my problem.

    Welcome to the Forum! Please read this topic to learn how to post your code correctly along with other useful info for newcomers.

  4. #4
    Junior Member
    Join Date
    Jan 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: please help me with this I don't know where is my problem.

    import java.swing.*;
    import java.math.*;
    public class KonvertoMatricenNeVektor {
     
    	public static void main(String[] args) 
    	{int a =new Integer (JOptionPane.showInputDialog("Jepni numrin e rreshtave")).intValue();
    	int b= new Integer(JOptionPane.showInputDialog("Jepni numrin e shtyllave")).intValue();
        int matrica [][]=new int [a][b];
        for(int i=0; i<b; i++)
        {for(int j=0; j<a; j++)
        	 matrica[i][j]=(int) ((int) Math.random()*10);   
        vektor(matrica);}}
    	public static void vektor(int[][]m)
    	{int rr=0;
    	int sh=0;
    	for(int i=0;i<m.length;i++)
    	{	rr+=1;
    	for(int j=0;j<m[i].length;j++)
    	sh+=1;}
    	int vektor[]=new int[rr*sh];
    	int k=0;
    	for(int i=0; i<m[i].length;i++)
    		{k+=1;
    		for(int j=0;j<m.length;j++)
    		{vektor[k]=m[i][j];
    		k+=1;}
    	for(int a=0;a<vektor.length;a++)
    		System.out.println(vektor[a]);}
     
    		}
     
     
    	}

  5. #5
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: please help me with this I don't know where is my problem.

    Thank you for posting your code correctly. Now, what is your question? What "problem" are you asking for help with? Ask specific questions. Post errors, if any. What is the code supposed to do, and how is it under performing? Give us something to work with.

Similar Threads

  1. Replies: 0
    Last Post: April 22nd, 2013, 11:00 AM
  2. Replies: 5
    Last Post: October 12th, 2012, 02:24 PM
  3. Replies: 1
    Last Post: June 9th, 2012, 11:29 AM
  4. I don't know where my problem is help please. :D
    By MiMiK in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 20th, 2010, 06:14 PM
  5. [SOLVED] Experiencing a run time error, don't know what the problem is
    By scooty199 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 3rd, 2010, 10:21 AM