Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ explicit type is missing('int' assumed)
    text
    copied!<p>Hi I have an error in my c++ code. I have 2 .cpp files and 1 .h file, Im trying to access 5 strings and 1 int from the header file but I get an error that says "explicit type is missing('int' assumed). </p> <p>I have some other errors too which are: Missing type specifier, Shops::Items redefinition; different basic types, Overloaded function differs only by return type and declaration is incompatible.</p> <p>Here are my files:</p> <p><strong>UserChoice.h</strong></p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; using namespace std; #ifndef USERCHOICE_H #define USERCHOICE_H class Shops { public: double Items(string, string, string, string, string, int); int main() { std::cout &lt;&lt; newItem1; } private: string newItem1; string newItem2; string newItem3; string newItem4; string newItem5; int newItems; }; #endif </code></pre> <p><strong>Items.cpp</strong></p> <pre><code>#include "UserChoice.h" Shops::Items(string Item1, string Item2, string Item3, string Item4, string Item5, int Items) { newItem1 = Item1; newItem2 = Item2; newItem3 = Item3; newItem4 = Item4; newItem5 = Item5; newItems = Items; } </code></pre> <p><strong>Source.cpp</strong></p> <pre><code>#include "UserChoice.h"; #include &lt;string&gt; int main() { string Item1; string Item2; string Item3; string Item4; string Item5; int items; std::cout &lt;&lt; "What what you like? Chicken, Meat, Fish, Carrot or Apple?\n"; std::cin &gt;&gt; Item1; std::cout &lt;&lt; "\nAnything else?\n"; std::cin &gt;&gt; Item2; if(Item2 == "nothing else") { } std::cout &lt;&lt; "\nAnything else?\n"; std::cin &gt;&gt; Item3; std::cout &lt;&lt; "\nAnything else?\n"; std::cin &gt;&gt; Item4; std::cout &lt;&lt; "\nAnything else?\n"; std::cin &gt;&gt; Item5; std::cout &lt;&lt; "\nAnything else?\n"; } </code></pre> <p><strong>Error line</strong></p> <pre><code>Shops::Items(string Item1, string Item2, string Item3, string Item4, string Item5, int Items) </code></pre> <p>All the code isn't finished yet so I hope you can help me find and fix these errors. Thanks in advance and if you need anymore info just ask me.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload