0

do u know how can i debug this code and whats the compiler's error?? i can not understand the errors i recieved in codeblocks an

#include <iostream> using namespace std; class q { private: char a[3]; int front , rear; public: void set (void); void insert(char); char remove(void); }; void q::set(void){ front=0; rear=0; } void q::insert(char ch) { if (rear==2){cout<<"ful"; return;} rear++; a[rear]=ch; } char q::remove(void) { if(front==rear) {cout<<"empty";return 0;} front++; return a[front]; } int main() { q ob; ob.set(); ob.insert('A'); ob.insert('B'); cout<<ob.remove();}

19th Jan 2022, 8:35 AM
Nariman Tajari
Nariman Tajari - avatar
6 odpowiedzi
+ 1
on line 35 change {if (rear==2){cout<<"ful"; return;} into if (rear==2){cout<<"ful"; return;}
19th Jan 2022, 8:41 AM
Shen Bapiro
Shen Bapiro - avatar
+ 1
yes guys after removing extra { from all if conditionals the errors disapeared.
19th Jan 2022, 9:08 AM
Nariman Tajari
Nariman Tajari - avatar
19th Jan 2022, 8:36 AM
Nariman Tajari
Nariman Tajari - avatar
0
Remove the extra { in line 34.
19th Jan 2022, 8:42 AM
你知道規則,我也是
你知道規則,我也是 - avatar
0
thanks for that point but even after remove the { that and ... the errors are in their own place ,
19th Jan 2022, 8:45 AM
Nariman Tajari
Nariman Tajari - avatar
0
this is the compiler's error: qualified-id in declaration before '(' token in line 43
19th Jan 2022, 8:46 AM
Nariman Tajari
Nariman Tajari - avatar