1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to be a human compiler

  1. Feb 15, 2008 #1
    i need to find out if its working
    if its not working thatn what kind of bug i will get
    and how to fix it???

    i need to find it by myself with pen and paper
    anyone can suggest a system to solve this question
    it is very complicated for me
    i am looking for a way of simplification

    Code (Text):

     
    public class Q5
    {
        public static void main(String[] args)
        {
            int len,i;
            int[] arr;
            len=10;
            arr= new int[len];
           
            for(i = 0 ; i < len ; i=i+1)
            {
                arr[i] = (Math.random()*101);
            }
            Fun1(arr);    .
            Fun2 (arr);    
            Fun1 (arr);    
        }
       
        public void Fun2 (int[] arr)
        {
            int to,minInd, from;
            to= arr.length;
            minInd=0;
            for(from=to;from>to;from=from-1)
            {
                minInd = minIndex(arr,from,to);
                swap(arr, from, minInd);
            }    
        }
       
        public int myminIndex(int[] arr, int from, int to)
        {
            int ans,i;
            ans= from;
            for(i =from+1; i< to ; i=i+1)
            {
                if (arr[ans-1] > arr[i])
                {
                    ans = i;
                }
                i=i-1;
               
            }
            return ans;
        }
       
        public void swap(int[] arr, int i, int j)
        {
            int tmp;
            tmp= arr[i];
            arr[i] = arr[j];
            arr[j] = tmp;
        }
       
        public void Fun1(int[ ] arr)
        {
            System.out.println();  // new line
            for(int i =0; i< arr.length ; i=i-1)
            {
                System.out.print();
                    }
            System.out.println();  // new line
        }
     
    }    
     
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you help with the solution or looking for help too?
Draft saved Draft deleted



Similar Discussions: How to be a human compiler
  1. How do you compile C? (Replies: 5)

Loading...