Validating inputs using fucntion : I really needed help here on how to write an input validation using function i know while loop validation but in this case i really wanted to know how to write a function to validate my inputs so that i can call the function from my inputs to take care of incorrect inputs.

in my code i accept integers from user inputs and characters please see my code below.



# include <iostream>




using namespace std;


//Function Declarations

//Shouf shouf Habibi row.



int shouf_normal (int a, int b )
{
	
	int shouf_normal=a* b;
	

	return shouf_normal; 
	
	
}

int shouf_Premium(int b, int c)
{
	
  int shouf_premium=b*c;
  
  return shouf_premium;
  	
	
	
}


//The interview row

double interview_normal(double c, double d)

{
	
	double interview_normal=(c*d);
	
	return interview_normal;
}



double interview_premium(double d, double e)

{
	
	double interview_premium=d*e;
	
	return interview_premium;
}


//New Kids turbo row

int turbo_normal(int e, int f)
{
	
	int turbo_normal=e*f;
	
	return turbo_normal;
	
}


// The Butterflies row


int butterflies_normal(int f, int g)
{
	
	int butterflies_normal=f*g;
	
	return butterflies_normal;
	
}






int main()
{
	
	 
	cout<<"\n\t"<<endl;
	cout<<"\t|******************************************************************|"<<endl;
	cout<<"\t|Welcome to A31 Cinema, where you watch latest and cheapest movies.|"<<endl;
    cout<<"\t|******************************************************************|"<<endl;
	
	cout<<"\n\tBelow are the movies screening lists.\n\tThe price of tickets are given according to seats classes\n\tand quality of movie."<<endl;
	cout<<"\n\tNote:Glassses for 3D movies cost $3.00."<<endl;
	cout<< "\t__________________________________________________________________"<<endl;
	cout<<"\t| Movie Title         |      Normal         |      Premium         |"<<endl;
	cout<<"\t|_____________________|_____________________|______________________|"<<endl;
	cout<<"\t|1.Shouf Shouf Habibi |        $5.00        |      $7.00           |"<<endl;
    cout<<"\t|_____________________|_____________________|______________________|"<<endl;
    cout<<"\t|2.The Interview (3D) |        $7.00        |     $9.50            |"<<endl;
    cout<<"\t|_____________________|_____________________|______________________|"<<endl;
    cout<<"\t|3.New Kids Turbo (3D)|        $7.00        |"<<endl;
    cout<<"\t|_____________________|_____________________|"<<endl;
    cout<<"\t|4.Black Butterflies  |        $5.00        |"<<endl;
    cout<<"\t|_____________________|_____________________|"<<endl;
    
      
    //constant initials
    
    const int a=5;
	const int b=7;
    const double c=7;
	const double d=9.5;
    const int e=7;
    const int glass=3;
    const int f=5;
    double total_tickets=0;
    int choice=0; 
    int number=0;
    char reply;
    
    bool correct_entry=true;
    string not_int;
    int not_char;
    
    
    cout<<"\n\tPlease choose from the lists (1-4) above and press enter:";
    
    cin>>number;
    
    
    
		
	
    
    
    
    while(number>=1 && number<=4)
    {
    		
    	if (number==1)
    	{
    		
    		cout<<"\n\tYou have selected \"Shouf Shouf Habibi\".";
            cout<<"\n\tFor Normal; Press \"N\" or for premium class; Press \"P\":";
            cin>>reply;
            
           if(reply=='N'|| reply=='n')
           {
           	cout<<"\n\tYou have selected Normal class."<<endl;
            cout<<"\n\tPlease choose the number of tickets you want:";
            cin>>choice;
           	
           	total_tickets=shouf_normal(a,choice);
            cout<<"\n\tYour total costs is=$"<<total_tickets<<endl;  //calculating & printing out cost 
		   }
		   
		    
	
		   
            
          if(reply=='P'||reply=='p') 
          {
          	
          	cout<<"\n\tYou have selected Premium class."<<endl;
            cout<<"\n\tPlease choose the number of tickets you want:";
            cin>>choice;
     
          	total_tickets=shouf_Premium (b,choice);
            cout<<"\n\tYour total costs is=$"<<total_tickets<<endl;  //calculating & printing out cost 
		  }
		    
             
    
		}
    	
       if(number==2)
       {
       	cout<<"\n\tYou have selected \"The interview\"in 3D quality.";
        cout<<"\n\tFor Normal; press \"N\" or for premium class; Press \"P\":";
        cin>>reply;
        
        
         if(reply=='N'|| reply=='n')
         {
          cout<<"\n\tYou have selected Normal class.";
          cout<<"\n\tPlease choose the number of tickets you want:";
          cin>>choice;
          total_tickets=interview_normal(c,choice)+(glass*choice);
          
          cout<<"\n\t Price for one ticket is $"<<c<<endl;
          cout<<"\n\tPrice for one 3D glass is $"<<glass<<endl;
          cout<<"\n\t Your total costs is=$"<<total_tickets<<endl;
         	
         	
		 }
       	
       	 if(reply=='P'|| reply=='p')
			{
       	 	 cout<<"\n\tYou have selected Premium class.";
             cout<<"\n\tPlease choose the number of tickets you want:";
             cin>>choice;
             total_tickets=interview_premium(d,choice)+(glass*choice);
             
             cout<<"\n\t Price for one ticket is $"<<d<<endl;
             cout<<"\n\tPrice for one 3D glass is $"<<glass<<endl;
             cout<<"\n\t Your total costs is=$"<<total_tickets<<endl;
         	
   
       	 	
       	 	
       	 	
			}
       	
       	 
	   }
    	
    	
     if(number==3)
     {
     	
     	cout<<"\n\tYou have selected \"The New Kids Turbo\" in 3D quality.";
        cout<<"\n\tThis moview is available only in Normal class.";
        cout<<"\n\tPlease choose the number of tickets you want:";
        cin>>choice;
        total_tickets=turbo_normal(e,choice)+(glass*choice);
        
             cout<<"\n\t Price for one ticket is $"<<e<<endl;
             cout<<"\n\tPrice for one 3D glass is $"<<glass<<endl;
             cout<<"\n\tYour total costs is=$"<<total_tickets<<endl;
  
     	
     	
     	
	 }
    	
    	
	
     if (number==4)
     {
       cout<<"\n\tYou have selected \"Black Butterflies\".";
       cout<<"\n\tThis Movie is available only in Normal class.";
       cout<<"\n\tPlease choose the number of tickets you want:";
       cin>>choice;   
       total_tickets=butterflies_normal(f,choice);
       cout<<"\n\tYour total costs is=$"<<total_tickets<<endl;	
    		
     	
	 }
    
     
    	
	
    	
    	cout<<"\n\tPlease choose from the lists (1-4) above and press enter or \n\t press \"Q\" to quit:";
        cin>>number; 
        
        while( number!=(number>=1&& number<=4))
        {
        cout<<"\n\tPlease choose from the lists (1-4) above and press enter or \n\t press \"Q\" to quit:";
        cin>>number; 
        	
		}
        
        if(number=='Q'|| number=='q')
        {
        	cout<<"\n\t\tThank You purchasing movie tickets with us!"<<endl;
		}
       	
	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
	}
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}




