calling validation function
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
void moive_valid(int movie_type)
{
while (movie_type<1 || movie_type>4)
{
cout<<"invalid option please enter integers between 1-4"<<endl;
cin>>movie_type;
while (cin.fail())
{
if(cin.fail())
{
cin.clear();
string input;
cin>>input;
cout<<"invaalid option please enter integers between 1-4"<<endl;
cin>>movie_type;
}
}
}
|
how can i call the function in my int main
i used the below code but it does not seem to work
1 2 3 4 5 6 7
|
cout<<"\nWhat Moive Would You Like to Watch[1-4]"<<endl;
cin>>movie_type;
// validation for movie type
void moive_valid(int movie_type);
|
please help
Remove data type when calling your function
thanks
got it correct now
Topic archived. No new replies allowed.