calling a function using defined header in C++ -


i relatively new c++. trying call function using defined header. have following 2 files(in addition enter.h file):

// 1. main.cpp

 #include "enter.h"  #include<iostream>  using namespace std;   int main()  {  int intdemo=enter();  cout << "the result is: " << intdemo<< endl; } 

// 2. enter.cpp

#include <iostream>    using namespace std;    int enter()    {    int thisisanumber;      cout<<"please enter number: ";      cin>>thisisanumber;      return thisisanumber;    } 

i getting following error message "void value not ignored ought be". , pointed second line of main function value of variable "intdemo" assigned

can suggest how fix error? have searched of similar posts here cannot able understand problem. since beginner, appreciated.

your header file declares function enter() return void (this confirmed in comments).

changing match function definition solve problem, unresolved external error getting side effect of this.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -