Using a function:
int inputdata()
{
int data;
std::cin >> data;
return data;
}
Then:
int a=inputdata();
For data itself:
int inputdata()
{
static bool isDataDeclared=false;
if (isDataDeclared==true)
{
goto read_data;
}
else
{
isDataDeclared=true;
}
static int data=inputdata();
return data;
read_data:
std::cin >> data;
return data;
}