Is it possible to print the .00 in the Part_Price[] so it would say 11.00 instead of 11.

#include <cstdio>
#include <cstdlib>
#include <iostream>


using namespace std;

double Part_Code[10]={1,2,3,4,5,6,7,8,9,10};
double Part_Number[10]={101,202,303,404,505,606,707,808,909,1010};
double Part_Price[10]={5.00,4.00,6.00,8.00,10.00,11.00,15.00,20.00,3.50,12.50,};
double Number_OnHand[10]={20,15,10,50,13,5,9,7,15,6};

int main(int nNumberofArgs, char* pszArgs[])
{

	int Pnumb,i;


	cout << "Enter Part Code '1' thru '10' please or enter '0' for inventory list: ";

	cin >> Pnumb;

        if(Pnumb!=0)
                {
            cout << "Cost of part number: " << Pnumb << " is: $" << Part_Price[Pnumb-1] << endl;

            cout << "Part Number for code '" << Pnumb << "' is: " << Part_Number[Pnumb-1] <<endl;
                }
        else
                {

            cout << "Here is a List of our inventory: \n" <<endl;

                    for(i=0;i<10;i++)

            cout << "Part Code: " << Part_Code[i] << " Part Number: " << Part_Number[i]
            << " Part Price:$"<< Part_Price[i] << " Number on Hand: " << Number_OnHand[i] << "\n" <<endl;

                }


	system ("pause");
	return 0;
}

You need to also make sure its on fixed format. Here is an example :

void printDollars(const float amount){
 //save old states
 std::ios_base::fmtflags oldFlg = cout.setf(std::ios::fixed, std::ios::floatfield);
 int oldPrecision = cout.precision(2);

 cout << "$ " << amount << endl;

 //reset old states
 cout.setf(oldFlg);
 cout.precision(oldPrecision);

}
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.