Knowee
Questions
Features
Study Tools

/home/ubuntu/Main.cpp:22:5: error: expected unqualified-id before ‘delete’ 22 | int delete(){ | ^~~~~~/home/ubuntu/Main.cpp: In function ‘int main()’:/home/ubuntu/Main.cpp:72:13: error: ‘insert’ was not declared in this scope 72 | insert(item); | ^~~~~~/home/ubuntu/Main.cpp:75:63: error: expected primary-expression before ‘)’ token 75 | printf("Element deleted from queue is :%d",delete()); | ^

Question

/home/ubuntu/Main.cpp:22:5: error: expected unqualified-id before ‘delete’ 22 | int delete(){ | ^~/home/ubuntu/Main.cpp: In function ‘int main()’:/home/ubuntu/Main.cpp:72:13: error: ‘insert’ was not declared in this scope 72 | insert(item); | ^~/home/ubuntu/Main.cpp:75:63: error: expected primary-expression before ‘)’ token 75 | printf("Element deleted from queue is :%d",delete()); | ^

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

The errors you're encountering are due to the misuse of reserved keywords in C++.

  1. The first error is because delete is a reserved keyword in C++. You cannot use it as a function name. You should rename your function to something else, like deleteElement.

  2. The second error is because the compiler cannot find a function named insert. You need to make sure that you have defined a function named insert in your code.

  3. The third error is related to the first one. Since delete is a reserved keyword, you cannot use it as a function. After renaming your delete function to deleteElement, you should also change this line to printf("Element deleted from queue is :%d",deleteElement());

This problem has been solved

Similar Questions

/home/ubuntu/Main.cpp:3:15: error: expected unqualified-id before ‘int’ 3 | char register(int weight, double height) { | ^~~/home/ubuntu/Main.cpp:3:15: error: expected ‘)’ before ‘int’ 3 | char register(int weight, double height) { | ~^~~ | )/home/ubuntu/Main.cpp: In function ‘int main()’:/home/ubuntu/Main.cpp:30:16: error: expected primary-expression before ‘register’ 30 | category = register(weight, height); | ^~~~~~~~

home/ubuntu/Main.cpp: In function ‘int main()’:/home/ubuntu/Main.cpp:60:13: error: ‘exit’ was not declared in this scope 60 | exit(0); | ^~~~

/home/ubuntu/Main.cpp:9:29: error: ISO C++ forbids declaration of ‘item’ with no type [-fpermissive] 9 | item(string id,int days) : itemid(id),daysoverdue(days){} | ^/home/ubuntu/Main.cpp: In member function ‘int Item::item(std::string, int)’:/home/ubuntu/Main.cpp:9:33: error: only constructors take member initializers 9 | item(string id,int days) : itemid(id),daysoverdue(days){} | ^~~~~~/home/ubuntu/Main.cpp:9:62: warning: no return statement in function returning non-void [-Wreturn-type] 9 | item(string id,int days) : itemid(id),daysoverdue(days){} | ^/home/ubuntu/Main.cpp: In constructor ‘book::book(std::string, int)’:/home/ubuntu/Main.cpp:15:44: error: no matching function for call to ‘Item::Item(std::string&, int&)’ 15 | book(string id,int days) : Item(id,days) {} | ^/home/ubuntu/Main.cpp:3:7: note: candidate: ‘Item::Item()’ 3 | class Item | ^~~~/home/ubuntu/Main.cpp:3:7: note: candidate expects 0 arguments, 2 provided/home/ubuntu/Main.cpp:3:7: note: candidate: ‘Item::Item(const Item&)’/home/ubuntu/Main.cpp:3:7: note: candidate expects 1 argument, 2 provided/home/ubuntu/Main.cpp:3:7: note: candidate: ‘Item::Item(Item&&)’/home/ubuntu/Main.cpp:3:7: note: candidate expects 1 argument, 2 provided/home/ubuntu/Main.cpp: At global scope:/home/ubuntu/Main.cpp:24:15: error: expected ‘)’ before ‘id’ 24 | dvd(String id,int days) : Item(id,days){} | ~ ^~~ | )/home/ubuntu/Main.cpp: In constructor ‘magazine::magazine(std::string, int)’:/home/ubuntu/Main.cpp:33:46: error: no matching function for call to ‘Item::Item(std::string&, int&)’ 33 | magazine(string id,int days):Item(id,days){} | ^/home/ubuntu/Main.cpp:3:7: note: candidate: ‘Item::Item()’ 3 | class Item | ^~~~/home/ubuntu/Main.cpp:3:7: note: candidate expects 0 arguments, 2 provided/home/ubuntu/Main.cpp:3:7: note: candidate: ‘Item::Item(const Item&)’/home/ubuntu/Main.cpp:3:7: note: candidate expects 1 argument, 2 provided/home/ubuntu/Main.cpp:3:7: note: candidate: ‘Item::Item(Item&&)’/home/ubuntu/Main.cpp:3:7: note: candidate expects 1 argument, 2 provided/home/ubuntu/Main.cpp: In function ‘int main()’:/home/ubuntu/Main.cpp:46:25: error: no matching function for call to ‘dvd::dvd(std::string&, int&)’ 46 | dvd d(id,daysoverdue); | ^/home/ubuntu/Main.cpp:21:7: note: candidate: ‘dvd::dvd()’ 21 | class dvd : public Item | ^~~/home/ubuntu/Main.cpp:21:7: note: candidate expects 0 arguments, 2 provided/home/ubuntu/Main.cpp:21:7: note: candidate: ‘dvd::dvd(const dvd&)’/home/ubuntu/Main.cpp:21:7: note: candidate expects 1 argument, 2 provided/home/ubuntu/Main.cpp:21:7: note: candidate: ‘dvd::dvd(dvd&&)’/home/ubuntu/Main.cpp:21:7: note: candidate expects 1 argument, 2 provided/home/ubuntu/Main.cpp:49:23: error: ‘m’ was not declared in this scope 49 | d.calculatefees()+m.calculatefees(); | ^

Compiler Message/home/ubuntu/Main.cpp:20:20: warning: missing terminating " character 20 | printf("Invalid type entered! | ^/home/ubuntu/Main.cpp:20:20: error: missing terminating " character 20 | printf("Invalid type entered! | ^~~~~~~~~~~~~~~~~~~~~~/home/ubuntu/Main.cpp:21:1: warning: missing terminating " character 21 | "); | ^/home/ubuntu/Main.cpp:21:1: error: missing terminating " character 21 | "); | ^~~/home/ubuntu/Main.cpp:27:20: warning: missing terminating " character 27 | printf("Integer: %d | ^/home/ubuntu/Main.cpp:27:20: error: missing terminating " character 27 | printf("Integer: %d | ^~~~~~~~~~~~/home/ubuntu/Main.cpp:28:1: warning: missing terminating " character 28 | ", *(int*)value); | ^/home/ubuntu/Main.cpp:28:1: error: missing terminating " character 28 | ", *(int*)value); | ^~~~~~~~~~~~~~~~~/home/ubuntu/Main.cpp:31:20: warning: missing terminating " character 31 | printf("Float: %.2f | ^/home/ubuntu/Main.cpp:31:20: error: missing terminating " character 31 | printf("Float: %.2f | ^~~~~~~~~~~~/home/ubuntu/Main.cpp:32:1: warning: missing terminating " character 32 | ", *(float*)value); | ^/home/ubuntu/Main.cpp:32:1: error: missing terminating " character 32 | ", *(float*)value); | ^~~~~~~~~~~~~~~~~~~/home/ubuntu/Main.cpp: In function ‘int main()’:/home/ubuntu/Main.cpp:22:13: error: expected primary-expression before ‘return’ 22 | return 0; | ^~~~~~/home/ubuntu/Main.cpp:29:13: error: expected primary-expression before ‘break’ 29 | break; | ^~~~~/home/ubuntu/Main.cpp:33:13: error: expected primary-expression before ‘break’ 33 | break; | ^~~~~Sample TestcaseTestcase 1 - FailedExpected OutputInteger: 4OutputTestcase 2 - FailedExpected OutputFloat: 5.50OutputTestcase 3 - FailedExpected OutputInvalid type entered!

/home/ubuntu/Main.cpp:24:15: error: expected ‘)’ before ‘id’ 24 | dvd(String id,int days) : Item(id,days){} | ~ ^~~ | )/home/ubuntu/Main.cpp: In function ‘int main()’:/home/ubuntu/Main.cpp:46:17: error: no matching function for call to ‘dvd::dvd(std::string&, int&)’ 46 | dvd d(did,dd); | ^/home/ubuntu/Main.cpp:21:7: note: candidate: ‘dvd::dvd(const dvd&)’ 21 | class dvd : public Item | ^~~/home/ubuntu/Main.cpp:21:7: note: candidate expects 1 argument, 2 provided/home/ubuntu/Main.cpp:21:7: note: candidate: ‘dvd::dvd(dvd&&)’/home/ubuntu/Main.cpp:21:7: note: candidate expects 1 argument, 2 provided/home/ubuntu/Main.cpp:49:23: error: ‘m’ was not declared in this scope 49 | d.calculatefees()+m.calculatefees(); | ^

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.