Professional Documents
Culture Documents
Tiru U Uuuuuuu
Tiru U Uuuuuuu
#include<conio>
#include<iomanip>
#include<stdio>
#include<math>
#include<fstream>
struct infoShirt
{
/*
double grand_total_shirt;
double sum_total_shirt;
double money;
double balance;
double distance;
double deliveryCost;
*/
int count_customer;
double totalQuantity;
double dis_rate;
double netpay;
char customer[50];
char code;
double total_shirt;
char address;
double quantity;
double delivery;
int per_oder;
}info[50];
void
void
void
void
void
void
void
int i =0;
void ReadData(infoShirt info[], int &count_customer , ofstream& outData, int nu
mber )
{
char respond= 'y';
char nextshirt;
int k =0;
cin>>respond;
cin.ignore();
cout<<endl;
cout<<endl;
if ( info[i].total_shirt >=0 && info[i].total_shirt <450)
{
info[i].dis_rate=(30.0/100.0)*info[i].total_shirt;
}
else if( info[i].total_shirt >=450 && info[i].total_shirt <500)
{
info[i].dis_rate=(35.0/100.0)*info[i].total_shirt;
}
else if ( info[i].total_shirt >=500)
{
info[i].dis_rate=(40.0/100.0)*info[i].total_shirt;
}
else
{
cout<<"Wrong Input dis_shirt"<<endl;
}
cout<<endl;
i++;
count_customer= i;
cout<<endl;
double sum=0.0;
double avg = 0.0;
for ( int i=0; i<count_customer ;i++)
{
sum=sum+info[i].netpay;
avg=sum/count_customer;
}
cout<<endl<<endl;
cout<<"Sum of all price are : RM "<<sum<<endl;
cout<<"Average price
: RM "<<avg<<endl;
outData<<"Sum of all price are : RM "<<sum<<endl;
outData<<"Average price
: RM "<<avg<<endl;
}
void sorting( infoShirt info[], int &count_customer, ofstream& outData)
{
float pass,hold ;
int tempCount = count_customer;
for (pass =1; pass < tempCount ; pass++)
{
for(int i=0; i < tempCount-1 ; i++)
if( info[i].netpay > info[i+1].netpay)
{
hold = info[i].netpay;
info[i].netpay = info[i+1].netpay;
info[i+1].netpay = hold;
}
}
cout<<endl<<endl<<"Sorted amount in acending order: ";
outData<<"Sorted amount in acending order: ";
cout<<endl;
for ( int i=0; i<tempCount ;i++)
{
cout<<"RM"<<info[i].netpay<<" ";
outData<<"RM"<<info[i].netpay<<" ";
}
}
void findMax( infoShirt info[], int &count_customer , ofstream& outData)
{
cout<<endl<<endl ;
cout<<"Highest amount of customer buy: RM"<<max<<endl ;
outData<<endl<<"Highest amount of customer buy: RM"<<max<<endl ;
}
void findMin( infoShirt info[], int &count_customer , ofstream& outData)
{
float min = info[0].netpay;
for ( int i=0; i<count_customer ;i++)
{
if(min>info[i].netpay)
{
min = info[i].netpay ;
}
else
{
min = min ;
}
}
cout << "Lowest amout of customer buy: RM" <<min<< endl ;
outData<<"Lowest amout of customer buy: RM"<<min<<endl;
}
int main()
{
int count_customer=0;
int number=0;
int *p;
p=&number;
ofstream outData;
outData.open("Result.txt");
cout<<"--------------------------------------------------------------"<<endl;
cout<<"------SELAMAT DATANG KE ISLAMIC MALAYA TSHIRT SDN. BHD.-------"<<endl;
cout<<"--------------------------------------------------------------"<<endl<
<endl;
cout<<"PILIHAN BAJU UNTUK ANDA :"<<endl;
cout<<"_________________________________________________"<<endl;
cout<<"|NAMA TSHIRT"<<'\t'<<"| KOD TSHIRT"<<'\t'<<"| HARGA TSHIRT |"<<endl;
cout<<"|________________________________________________|"<<endl;
cout<<"|I AM MUSLIM"<<"\t\t"<<"A"<<"\t"<<"
RM25.00
|"<<endl;
cout<<"|UKHWAHFILLAH"<<"\t\t"<<"B"<<"\t"<<"
RM26.00
|"<<endl;
cout<<"|FREE PALESTINE"<<"\t\t"<<"C"<<"\t"<<"
RM23.00
|"<<endl;
cout<<"|SAVE GAZA"<<"\t\t"<<"D"<<"\t"<<"
RM30.00
|"<<endl;
cout<<"|PRAY FOR GAZA"<<"\t\t"<<"E"<<"\t"<<"
RM30.00
|"<<endl;
cout<<"|________________________________________________|"<<endl;
cout<<endl;
getch();
}