Error with the code

Hello everyone, I am a newbie to C++ and probably have made a few mistakes with the code. I am creating my own function. And the code seems to work fine when I only introduce a single variable. Upon adding any other variable, the code seems to go haywire.

#include <iostream>
int vishal(int x);
int main()
{
using namespace std;

int x;
int y;
cout<<"enter a variable"<<endl;
cin>>x;
cout<<"The division results are "<<vishal(x)<<endl;
return 0;
}

int vishal(int x)

{
int y;
=
return y*x;

}

So, all I want to do is like when I run the program, it asks me to put the variable for X. I want to make that happen for Y too! So, it should ask for both variables and then compute the answer.
Is that possible?
Thanks :)

Topic archived. No new replies allowed.