The highlighted part below is where the function located...Is there any problem with the input?

#include <iostream>
#include <iomanip>
using namespace std;
  // function declaration for price to pay.
float caldiscountprice(float[],int[],float[]);  // function declaration for discounted price.
float calpriceafterdiscount(float[],int[],float[]);  //function declaration for Price after Discount
int main()
{
 int stocknumber[5],quantity[5],count=1,backwardcount=2,i;
 float price[5],discount[5],discountprice[5],priceafterdiscount[5];
 cout.setf (ios::fixed);
 cout.setf (ios::showpoint);
 cout.precision (2);
 
    for (i=0;i<5;i++)
 {
  while (count<=3)
   {
   
   
     cout<<"Please enter the stock number."<<endl;
      
 
          cin>>stocknumber[i];
   
    
    
  if ((stocknumber[i]>=1) && (stocknumber[i]<=9999))
   break;
  if ((stocknumber[i]<=0) || (stocknumber[i]>=10000))
   cout<<"The number you entered is invalid. Please reenter another stock number."<<endl;
            cout<<"You have"<<setw(2)<<backwardcount<<setw(2)<<" chance(s) left"<<endl;
   backwardcount--;
   count++;
       
   }
 
 if (count==4)
 {
  cout<<"Sorry, you have exceeded 3 times of input."<<endl;
  cout<<"Please restart the program or contact us for further services."<<endl;
  exit(1);
 }
 }
 
 
 for (i=0;i<5;i++)
 {
 cout<<"Please insert the price of the product."<<endl;
     cin>>price[i];
 cout<<"Please enter the quantity."<<endl;
 cin>>quantity[i];
 }
  
 
    for (i=0;i<5;i++)
 {
  if ((stocknumber[i]>=1) && (stocknumber[i]<=3000))
   
    discount[i]=0;
   
 else if ((stocknumber[i]>=3001) && (stocknumber[i]<=5000))
 
  discount[i]=float(10)/100;
 
 else if ((stocknumber[i]>=5001) && (stocknumber[i]<=8000))
 
  discount[i]=float(15)/100;
 
 else if ((stocknumber[i]>=8001) && (stocknumber[i]<=9999))
 
  discount[i]=float(20)/100;
 }
 
 for (i=0;i<5;i++)
 {
 
 discountprice[i]=caldiscountprice (discount,quantity,price);
 priceafterdiscount[i]=calpriceafterdiscount(price, quantity,discountprice);
 }
 
    for (i=0;i<5;i++)
 {
 cout<<endl;
 cout<<endl;
 cout<<"Invoice"<<endl;
 cout<<"============"<<endl;
 cout<<"Stock no:"<<stocknumber[i]<<endl;
 cout<<"Quantity:"<<quantity[i]<<endl;
 cout<<"Price per unit:"<<price[i]<<endl;
 
 cout<<"Discount given:"<<discountprice[i]<<endl;
 cout<<"Discounted Price:"<<priceafterdiscount[i]<<endl;
 }
 
 

  return 0;
}




float caldiscountprice (float discount[5],int quantity[5], float price[5])
{
 int i,stocknumber[5];
 float discountprice[5];
 for (i=0;i<5;i++)
 
	 
   
 {
  if ((stocknumber[i]>=1) && (stocknumber[i]<=3000))
   
    discount[i]=0;
   
 else if ((stocknumber[i]>=3001) && (stocknumber[i]<=5000))
 
  discount[i]=float(10)/100;
 
 else if ((stocknumber[i]>=5001) && (stocknumber[i]<=8000))
 
  discount[i]=float(15)/100;
 
 else if ((stocknumber[i]>=8001) && (stocknumber[i]<=9999))
 
  discount[i]=float(20)/100;
 }
 
 discountprice[i]=discount[i]*quantity[i]*price[i];
 
 return discountprice[i];
 
}

float calpriceafterdiscount(float price[5],int quantity[5], float discountprice[5])
{
 int i;
 float priceafterdiscount[5];
 for (i=0;i<5;i++)
 
 priceafterdiscount[i]=quantity[i]*price[i]-discountprice[i];
 
 return priceafterdiscount[i];
 
}

The highlighted part below is where the function located...Is there any problem with the input?

I don't know. Does it work?

its not working...

Would you care to explain what makes you think it's not working? Or should we guess?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.