folder Tahribat.com Forumları
linefolder Java
linefolder Kısa İki Java Kodunu C#' A Çevirir Misiniz ?



Kısa İki Java Kodunu C#' A Çevirir Misiniz ?

  1. KısayolKısayol reportŞikayet pmÖzel Mesaj
    zeybekustasi
    zeybekustasi's avatar
    Kayıt Tarihi: 24/Mayıs/2012
    Erkek

    1. Kod:

    class Queue
    {
    private int maxSize;
    private long[] queArray;
    private int front;
    private int rear;
    private int nItems;
    //--------------------------------------------------------------
    public Queue(int s) // constructor
    {
    maxSize = s;
    queArray = new long[maxSize];
    front = 0;
    rear = -1;
    nItems = 0;
    }
    //--------------------------------------------------------------
    public void insert(long j) // put item at rear of queue
    {
    if(rear == maxSize-1) // deal with wraparound
    rear = -1;
    queArray[++rear] = j; // increment rear and insert
    nItems++; // one more item
    }
    //--------------------------------------------------------------
    public long remove() // take item from front of queue
    {
    long temp = queArray[front++]; // get value and incr front
    if(front == maxSize) // deal with wraparound
    front = 0;
    nItems--; // one less item
    return temp;
    }
    //--------------------------------------------------------------
    public long peekFront() // peek at front of queue
    {
    138 CHAPTER 4 Stacks and Queues
    05 0672324539 CH04 10/10/02 9:09 AM Page 138return queArray[front];
    }
    //--------------------------------------------------------------
    public boolean isEmpty() // true if queue is empty
    {
    return (nItems==0);
    }
    //--------------------------------------------------------------
    public boolean isFull() // true if queue is full
    {
    return (nItems==maxSize);
    }
    //--------------------------------------------------------------
    public int size() // number of items in queue
    {
    return nItems;
    }
    //--------------------------------------------------------------
    } // end class Queue
    ////////////////////////////////////////////////////////////////
    class QueueApp
    {
    public static void main(String[] args)
    {
    Queue theQueue = new Queue(5); // queue holds 5 items
    theQueue.insert(10); // insert 4 items
    theQueue.insert(20);
    theQueue.insert(30);
    theQueue.insert(40);
    theQueue.remove(); // remove 3 items
    theQueue.remove(); // (10, 20, 30)
    theQueue.remove();
    theQueue.insert(50); // insert 4 more items
    theQueue.insert(60); // (wraps around)
    theQueue.insert(70);
    theQueue.insert(80);
    while( !theQueue.isEmpty() ) // remove and display
    { // all items
    Queues 139
    LISTING 4.4 Continued
    05 0672324539 CH04 10/10/02 9:09 AM Page 139long n = theQueue.remove(); // (40, 50, 60, 70, 80)
    System.out.print(n);
    System.out.print(“ “);
    }
    System.out.println(“”);
    } // end main()
    } // end class QueueApp

    2. Kod 

    class StackX
    {
    private int maxSize; // size of stack array
    private long[] stackArray;
    private int top; // top of stack
    //--------------------------------------------------------------
    public StackX(int s) // constructor
    {
    maxSize = s; // set array size
    stackArray = new long[maxSize]; // create array
    top = -1; // no items yet
    }
    //--------------------------------------------------------------
    public void push(long j) // put item on top of stack
    {
    stackArray[++top] = j; // increment top, insert item
    }
    120 CHAPTER 4 Stacks and Queues
    05 0672324539 CH04 10/10/02 9:09 AM Page 120//--------------------------------------------------------------
    public long pop() // take item from top of stack
    {
    return stackArray[top--]; // access item, decrement top
    }
    //--------------------------------------------------------------
    public long peek() // peek at top of stack
    {
    return stackArray[top];
    }
    //--------------------------------------------------------------
    public boolean isEmpty() // true if stack is empty
    {
    return (top == -1);
    }
    //--------------------------------------------------------------
    public boolean isFull() // true if stack is full
    {
    return (top == maxSize-1);
    }
    //--------------------------------------------------------------
    } // end class StackX
    ////////////////////////////////////////////////////////////////
    class StackApp
    {
    public static void main(String[] args)
    {
    StackX theStack = new StackX(10); // make new stack
    theStack.push(20); // push items onto stack
    theStack.push(40);
    theStack.push(60);
    theStack.push(80);
    while( !theStack.isEmpty() ) // until it’s empty,
    { // delete item from stack
    long value = theStack.pop();
    System.out.print(value); // display it
    System.out.print(“ “);
    } // end while
    System.out.println(“”);
    } // end main()
    Stacks 121
    LISTING 4.1 Continued
    05 0672324539 CH04 10/10/02 9:09 AM Page 121} // end class StackApp

    https://www.youtube.com/watch?v=WC3-71NKwPw
  2. KısayolKısayol reportŞikayet pmÖzel Mesaj
    Tarikat Şeyhi
    HolyOne
    HolyOne's avatar
    Kayıt Tarihi: 01/Haziran/2002
    Erkek

    1. kodu çevireyim

     

    System.Collections.Generic.Queue<long> q = new   System.Collections.Generic.Queue<long>();
    q.Enqueue(...)
    q.Dequeue(..)

    2. kod

    System.Collections.Generic.Stack<int> s=new Stack<int>();

    s.Pop(...)
    s.Push(...)

     

    :)


    Nush ile uslanmayanı etmeli tekdir, Tekdir ile uslanmayanın hakkı kötektir!
  3. KısayolKısayol reportŞikayet pmÖzel Mesaj
    u235
    u235's avatar
    Kayıt Tarihi: 31/Mart/2008
    Erkek
    HolyOne bunu yazdı

    1. kodu çevireyim

     

    System.Collections.Generic.Queue q = new   System.Collections.Generic.Queue();
    q.Enqueue(...)
    q.Dequeue(..)

    2. kod

    System.Collections.Generic.Stack s=new Stack();

    s.Pop(...)
    s.Push(...)

     

    :)

    bu nasıl birşey şeyhim.200 sayfalık kitabı el broşürüne özet dökmüşsün gibi oldu  :)

  4. KısayolKısayol reportŞikayet pmÖzel Mesaj
    tagext
    tagext's avatar
    Üstün Hizmet Madalyası Başarı Madalyası
    Kayıt Tarihi: 25/Temmuz/2002
    Erkek

    bu kodları olduğu gibi visual studio ya kopyala.

    derlenecektir. sadece şu kısmı değiştirmen lazım.

    public static void main(String[] args) 


    ftw
  5. KısayolKısayol reportŞikayet pmÖzel Mesaj
    SSH
    SSH's avatar
    Kayıt Tarihi: 21/Temmuz/2005
    Erkek
    HolyOne bunu yazdı

    1. kodu çevireyim

     

    System.Collections.Generic.Queue q = new   System.Collections.Generic.Queue();
    q.Enqueue(...)
    q.Dequeue(..)

    2. kod

    System.Collections.Generic.Stack s=new Stack();

    s.Pop(...)
    s.Push(...)

     

    :)

    normal değil :)


    sırıtma la.
  6. KısayolKısayol reportŞikayet pmÖzel Mesaj
    AyT
    AyT's avatar
    Kayıt Tarihi: 04/Mayıs/2008
    Erkek

    bu senin data structures ödevin demi ? =))


    Fuck you, you fucking fuck
  7. KısayolKısayol reportŞikayet pmÖzel Mesaj
    Ercan
    Ercan's avatar
    Kayıt Tarihi: 04/Temmuz/2008
    Erkek
    AyT bunu yazdı

    bu senin data structures ödevin demi ? =))

    haha bizim hoca da geçen sene vermiş bunun aynısını :)


    IF YOU ARE NOT TİRED, YOU ARE NOT DOING IT RIGHT
  8. KısayolKısayol reportŞikayet pmÖzel Mesaj
    Bektas
    x-files
    x-files's avatar
    Kayıt Tarihi: 06/Eylül/2005
    Erkek
    HolyOne bunu yazdı

    1. kodu çevireyim

     

    System.Collections.Generic.Queue q = new   System.Collections.Generic.Queue();
    q.Enqueue(...)
    q.Dequeue(..)

    2. kod

    System.Collections.Generic.Stack s=new Stack();

    s.Pop(...)
    s.Push(...)

     

    :)

    i love you filmindeki gibi oldu sanki adam ingilizce konuşuyor ne dedi diyor bilmem kısa bir cüme söylüyor. adam bir araba dolusu laf söyledi bunu mu demek istedi :D


    //Hayat Bazen Tatlıdır//--//Aşıksan vur saza şoförsen bas gaza// https://zulfumehmet.com/ Kişisel bir olay
Toplam Hit: 2707 Toplam Mesaj: 8