Can please someone explain me how to link the functions @ functions.cpp to main.cpp
note: I want both files functions.cpp and main.cpp to use the same variables from header.h
Thank you!
main.cpp
#include "Header.h"
#include <iostream>
using namespace std;
int multi();
int printOutRanomdNumber();
int main()
{
cout << "Eneter a number you want to multiply" << endl;
cout << multi() <<endl;
cout << printOutRanomdNumber();
system("pause");
return 0;
}
header.h
#ifndef _HEADER_
#define _HEADER_
#include <iostream>
using namespace std;
extern int randomNumber;
int multi();
int printOutRanomdNumber();
#endif
functions.cpp
#include "Header.h"
#include <iostream>
using namespace std;
int multi()
{
int x;
cin >> x;
return(x=x*x);
}
int printOutRanomdNumber()
{
cout << "Please enter a random number" << endl;
cin >> randomNumber;
return (randomNumber);
}