C++
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
Runtime options...
- voluntas
- @ignis_fatuus
- ブン
- @Linda_pp
- 清楚なC++メイドBOT
- @tzik_tack
- 長谷川一輝
- wraith13
- @jj1bdx
- @cpp_akira
- 安藤敏彦
- @srz_zumix
- Siv3D
- takezoh
- まろ
- @okdshin
- @hnokx
- @ishidakei
- @take_cheeze
- TAKEI Yuya
- @mumumu
- I (@wx257osn2)
- イズカワタカノブ
- @tyottyoworks
- ___shanon
- わたやん
- @KorekaraSEDB
- @kariya_mitsuru
- @ciniml
- @beam2d
- @grafi_tt
- @nekketsuuu
- LouiS0616
- @volanja
- 大鎌広
- むてら
- ガチKGB
x
81
queue->front= (queue->front+1)%queue->capacity;
1
2
using namespace std;
3
4
class Queue
5
{
6
public:
7
int rear, front, size,capacity;
8
int* arr;
9
10
Queue(int c)
11
{
12
capacity=c;
13
rear=c-1;
14
front=0;
15
int *arr= new int[c*sizeof(int)];
16
}
17
};
18
19
20
int isEmpty(Queue* queue)
21
{
22
return (queue->size==0);
23
}
24
25
int isFull(Queue* queue)
26
{
27
return (queue->size==queue->capacity);
28
}
$ g++ prog.cc -Wall -Wextra -std=c++2a
Start
prog.cc: In constructor 'Queue::Queue(int)': prog.cc:15:14: warning: unused variable 'arr' [-Wunused-variable] 15 | int *arr= new int[c*sizeof(int)]; | ^~~ prog.cc: In function 'int dequeue(Queue*)': prog.cc:46:10: warning: unused variable 'x' [-Wunused-variable] 46 | int x = queue->arr[queue->front]; | ^ prog.cc: In function 'int main()': prog.cc:69:28: error: no matching function for call to 'Queue::Queue()' 69 | Queue* queue=new Queue(); | ^ prog.cc:10:5: note: candidate: 'Queue::Queue(int)' 10 | Queue(int c) | ^~~~~ prog.cc:10:5: note: candidate expects 1 argument, 0 provided prog.cc:4:7: note: candidate: 'constexpr Queue::Queue(const Queue&)' 4 | class Queue | ^~~~~ prog.cc:4:7: note: candidate expects 1 argument, 0 provided prog.cc:4:7: note: candidate: 'constexpr Queue::Queue(Queue&&)' prog.cc:4:7: note: candidate expects 1 argument, 0 provided prog.cc: In function 'int dequeue(Queue*)': prog.cc:50:1: warning: control reaches end of non-void function [-Wreturn-type] 50 | } | ^
1
Finish