Professional Documents
Culture Documents
#include
#include
#include
"stdafx.h"
<iostream>
<conio.h>
<fstream>
}
}
cout << "Total average cost production : RM " << average/3;
keluar << "Total average cost production :RM " << average/3;
cout << endl;
keluar << endl;
}
for ( j=0; j<3; j++)
{
<< endl;
<< endl;
: RM " <<
<<endl;
: RM " <<
}
}
if (strcmp(bulan,month[h])==1 || (strcmp(bulan,"n")==1 ||
strcmp(bulan,"N")==1))
cout << "\n Invalid month\n" ;
}
void findLowest(shampoo shampooInfo[][3], int row, int col, char month[]
[12], char color [][10], ofstream& keluar)
{
strcpy_s(month[0],"January");
strcpy_s(month[1],"February");
strcpy_s(month[2],"March");
strcpy_s(color[0],"Blue");
strcpy_s(color[1],"Black");
strcpy_s(color[2],"Green");
double TotalCost [3][3];
for (int a=0; a<col; a++)
{
for (int b=0; b<row; b++ )
{
TotalCost[a][b] = shampooInfo[a][b].totalCost;
}
}
ofstream keluar;
keluar.open("totalReceipt.txt");
int countMonth=0;
char bulan[10];
char month[3][12];
strcpy_s(month[0],"January");
strcpy_s(month[1],"February");
strcpy_s(month[2],"March");
char color[3][10];
strcpy_s(color[0],"Blue");
strcpy_s(color[1],"Black");
strcpy_s(color[2],"Green");
double priceInput[2];
ifstream input;
input.open("priceInput.txt");
input >> priceInput[0];
input >> priceInput[1];
keluar << " Sinar Rambut Shampoo " << endl;
keluar << " ==================== \n" << endl;
for(int j=0; j < COL; j++)
{
cout << " Month : " << month[j] << endl;
keluar << " Month : " << month[j] << endl;
for(int i=0; i < ROW; i++)
{
cout << " Colour of Shampoo
: " << color[i] << endl;
keluar << " Colour of Shampoo : " << color[i] << endl;
keluar << endl;
cout << " Input amount for small: ";
cin >> shampooInfo[j][i].amountSizeS;
shampooInfo[j][i].smallCost = shampooInfo[j]
[i].amountSizeS * priceInput[0]; // to calculate cost of producig the small
size packaging for each type
keluar << " Amount for small size: " << shampooInfo[j]
[i].amountSizeS;
keluar << endl;
cout << " Input amount for big : ";
cin >> shampooInfo[j][i].amountSizeL;
shampooInfo[j][i].largeCost = shampooInfo[j]
[i].amountSizeL * priceInput[1];
keluar << " Amount for big size: " << shampooInfo[j]
[i].amountSizeL;
keluar << endl;
cout << " Cost of production of small " << color[j] << "
shampooInfo[j][i].smallCost<<endl;
keluar << " Cost of production of small " << color[j] <<
" shampoo : RM " << shampooInfo[j][i].smallCost<<endl;
keluar << endl;
shampoo : RM " <<
cout << " Cost of production of large " << color[j] << "
shampooInfo[j][i].largeCost <<endl;
keluar << " Cost of production of large " << color[j] <<
" shampoo : RM " << shampooInfo[j][i].largeCost <<endl;
keluar << endl;
shampoo : RM " <<
shampooInfo[j][i].totalAmount = shampooInfo[j]
[i].amountSizeL + shampooInfo[j][i].amountSizeS;
cout << " Total amount of production : " <<
shampooInfo[j][i].totalAmount << endl;
keluar << " Total amount of production : " <<
shampooInfo[j][i].totalAmount << endl;
keluar << endl;
shampooInfo[j][i].totalCost = shampooInfo[j][i].smallCost
+ shampooInfo[j][i].largeCost;
cout << "
shampooInfo[j][i].totalCost
keluar <<
shampooInfo[j][i].totalCost
keluar <<
: RM " <<
: RM " <<
bulan);