내 코드에 어떤 문제가 있습니까? 나는 그것을 분명히 실행할 수 없다. 아래는 제 코딩입니다. 누군가가 오류를 찾도록 도와 줄 수 있습니까?데이터 구조에서 큐 구현
다음과 같은 작업을 수행 할 수있는 큐 구현 :
- 인큐 ('A'를);
- 엔큐 ('b');
- 엔큐 ('c');
- 엔큐 ('d');
- 엔큐 ('e');
- 엔큐 ('f');
- 엔큐 ('g');
- 엔큐 ('h');
- Dequeue();
- Dequeue();
- Dequeue();
- Dequeue();
- 엔큐 ('i');
- 엔큐 ('j');
- Dequeue();
Dequeue();
public class Queues { public static void add(Queues <String>myQueue, String s) { myQueue.enqueue(s); public static void main(String[] args){ Queues myQueue = new Queues (20, 0, 0); myQueue.Enqueue('a'); myQueue.Enqueue('b'); myQueue.Enqueue('c'); myQueue.Enqueue('d'); myQueue.Enqueue('e'); myQueue.Enqueue('f'); myQueue.Enqueue('g'); myQueue.Enqueue('h'); myQueue.Enqueue(); myQueue.Enqueue(); myQueue.Enqueue(); myQueue.Enqueue(); myQueue.Enqueue(); myQueue.Enqueue(); myQueue.Enqueue('i'); myQueue.Enqueue('j'); myQueue.Enqueue(); myQueue.Display(); } } class Queue{ int x; char [] y; int front, rear, w; Queue (int a, b , c); x = a; y = new char[x]; front = b; rear = c; w = rear; boolean CHK_Q_EMPTY() return rear == 0; } boolean CHK_Q_FULL(){ return rear == x; } void Enqueue (char d){ y(rear) = d; rear++; w++; } void Dequeue(){ for (int z=1; z<rear; z++){ y[front]=y[z]; front++; } w--; if(front == rear){ front = 0; rear = w; } } void display(){ for (int i=0; i<rear; i++) System.out.println(y[i]); } }
실제 코드입니까? 컴파일되지 않습니다. 먼저 모든 컴파일 오류를 수정 한 다음 실행하고 가능한 한 많이 수정하고 새 대구를 붙여 넣은 다음 수행 할 작업과 잘못된 작업을 알려주십시오. – RealSkeptic
어디에 오류가 있는지 모르겠다 :// 그냥 초보자 : '( – Lolzz
그럼 StackOverflow를 사용하기에는 너무 빠릅니다. 자바 책을 읽어야합니다. 얻은 모든 컴파일 오류를보고 비교하려면 StackOverflow에서 대화 형 사이트가 아니기 때문에 거의 불가능합니다. 도움이 필요한 사람이 있으면 강사 나 조수와상의해야합니다. – RealSkeptic