Hi,
Please look at the following code:
[code=cpp]
dependencies(in t i)
{
string str;
vector<string> fd;
cout<<"enter the attributes of fd"<<i<<endl;
cin>>str;
fd.push_back(st r);
}
int _tmain(int argc, _TCHAR* argv[])
{
int num;
cout<<"Enter the number of functionaldepen dencies"<<endl;
cin>>num;
for(int i=0; i<num; i++)
{
dependencies(i) ;
}
return 0;
}
[/code]
In the above code I am calling the function "dependenci es" depending on the given input for number of functional dependencies. In the "dependenci es" function, whatever i am inputting is pushed into the vector. But everytime I call the function, the input that I give gets into the same vector.
But what i want to do is, everytime I call the function dependencies, it should create a new vector and push that iteration inputs into new vector instead of pushing into the same old vector.
Is it possible to do that way??
Please help!!
Thanks!!
Please look at the following code:
[code=cpp]
dependencies(in t i)
{
string str;
vector<string> fd;
cout<<"enter the attributes of fd"<<i<<endl;
cin>>str;
fd.push_back(st r);
}
int _tmain(int argc, _TCHAR* argv[])
{
int num;
cout<<"Enter the number of functionaldepen dencies"<<endl;
cin>>num;
for(int i=0; i<num; i++)
{
dependencies(i) ;
}
return 0;
}
[/code]
In the above code I am calling the function "dependenci es" depending on the given input for number of functional dependencies. In the "dependenci es" function, whatever i am inputting is pushed into the vector. But everytime I call the function, the input that I give gets into the same vector.
But what i want to do is, everytime I call the function dependencies, it should create a new vector and push that iteration inputs into new vector instead of pushing into the same old vector.
Is it possible to do that way??
Please help!!
Thanks!!
Comment