Any kind of help
question: What are they asking for?, context: Getting"Undefined Reference Error",not sure why! Here's the code of my program: #include&lt;iostream&gt; using namespace std; class Marks { private: static int x,y,s,a; public: static int sum() { cout&lt;&lt;"Enter marks of 1st subject: "; cin&gt;&gt;x; cout&lt;&lt;endl&lt;&lt;"Enter marks of 2nd subject: "; cin&gt;&gt;y; s=x+y; return s; } static float average() { cout&lt;&lt;"Enter marks of 1st subject: "; cin&gt;&gt;x; cout&lt;&lt;endl&lt;&lt;"Enter marks of 2nd subject: "; cin&gt;&gt;y; a=(x+y)/3; return a; } }; int main() { cout&lt;&lt;endl&lt;&lt;"Sum is: "&lt;&lt;Marks::sum(); cout&lt;&lt;endl&lt;&lt;"Average is: "&lt;&lt;Marks::average(); } It's a simple program where I have to initialize static members through user input. The user input will be taken in a static member function. I am getting the undefined reference error. Any kind of help will be appreciated. Thank you!
What are they asking for?
Any kind of help will be appreciated.
Getting"Undefined Reference Error",not sure why! Here's the code of my program: #include&lt;iostream&gt; using namespace std; class Marks { private: static int x,y,s,a; public: static int sum() { cout&lt;&lt;"Enter marks of 1st subject: "; cin&gt;&gt;x; cout&lt;&lt;endl&lt;&lt;"Enter marks of 2nd subject: "; cin&gt;&gt;y; s=x+y; return s; } static float average() { cout&lt;&lt;"Enter marks of 1st subject: "; cin&gt;&gt;x; cout&lt;&lt;endl&lt;&lt;"Enter marks of 2nd subject: "; cin&gt;&gt;y; a=(x+y)/3; return a; } }; int main() { cout&lt;&lt;endl&lt;&lt;"Sum is: "&lt;&lt;Marks::sum(); cout&lt;&lt;endl&lt;&lt;"Average is: "&lt;&lt;Marks::average(); } It's a simple program where I have to initialize static members through user input. The user input will be taken in a static member function. I am getting the undefined reference error. Any kind of help will be appreciated. Thank you!
<hl> Any kind of help <hl> will be appreciated.
Getting"Undefined Reference Error",not sure why! Here's the code of my program: #include&lt;iostream&gt; using namespace std; class Marks { private: static int x,y,s,a; public: static int sum() { cout&lt;&lt;"Enter marks of 1st subject: "; cin&gt;&gt;x; cout&lt;&lt;endl&lt;&lt;"Enter marks of 2nd subject: "; cin&gt;&gt;y; s=x+y; return s; } static float average() { cout&lt;&lt;"Enter marks of 1st subject: "; cin&gt;&gt;x; cout&lt;&lt;endl&lt;&lt;"Enter marks of 2nd subject: "; cin&gt;&gt;y; a=(x+y)/3; return a; } }; int main() { cout&lt;&lt;endl&lt;&lt;"Sum is: "&lt;&lt;Marks::sum(); cout&lt;&lt;endl&lt;&lt;"Average is: "&lt;&lt;Marks::average(); } It's a simple program where I have to initialize static members through user input. The user input will be taken in a static member function. I am getting the undefined reference error. <hl> Any kind of help <hl> will be appreciated. Thank you!
Getting"Undefined Reference Error",not sure why! Here's the code of my program: #include&lt;iostream&gt; using namespace std; class Marks { private: static int x,y,s,a; public: static int sum() { cout&lt;&lt;"Enter marks of 1st subject: "; cin&gt;&gt;x; cout&lt;&lt;endl&lt;&lt;"Enter marks of 2nd subject: "; cin&gt;&gt;y; s=x+y; return s; } static float average() { cout&lt;&lt;"Enter marks of 1st subject: "; cin&gt;&gt;x; cout&lt;&lt;endl&lt;&lt;"Enter marks of 2nd subject: "; cin&gt;&gt;y; a=(x+y)/3; return a; } }; int main() { cout&lt;&lt;endl&lt;&lt;"Sum is: "&lt;&lt;Marks::sum(); cout&lt;&lt;endl&lt;&lt;"Average is: "&lt;&lt;Marks::average(); } It's a simple program where I have to initialize static members through user input. The user input will be taken in a static member function. I am getting the undefined reference error. <hl> Any kind of help will be appreciated. <hl> Thank you!