Help me please ?

0 Putra Adhie · November 23, 2014
I was making a sales program using arrays

here's the screenshot

/images/forum/upload/2014-11-23/678ac9514899ca90b7dabc5fa5fcb0a4.PNG

and I want to enter the money paid just under the subtotal payment and  the money change under the money paid...

Can you help me to make the coding?
Please leave me some answer, because this forum is the last hope that i have, i've already confused... 

This is actually my college assignment ... If there are people who can and want to help me, I would be grateful

Here's the code


#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <iomanip.h>
#include <string.h>

main( )
{

int x ,a ,again;

char type[6]={'C','c','T','t','W','s'},*name[6];
long totalunit[6],total[6]={0},price[6]={2500,2000,1500};
long chicken[6]={0},tax[6],subtotal[6];


order:
clrscr( );
cout<<"\t    FRIED CHICKEN\n";
cout<<"\t---------------------\n";
cout<<"\t Code Kind   Price\n";
cout<<"\t---------------------\n";
cout<<"\t [C]  Chest  Rp. 2500\n";
cout<<"\t [T]  Thigh  Rp. 2000\n";
cout<<"\t [W]  Wings  Rp. 1500\n\n";
cout<<"\t---------------------\n\n";
cout<<"\tTotal unit : ";cin>>x;

chicken[x] = 0;

    if (x <= 0){
    cout<<"\n\t\tTotal unit not allow null";
    goto end;}
else {
for(a = 1 ; a <= x; ++a) {
      cout<<"\tType of - "<<a;
        cout<<"\n\tCode [C/T/W] : ";cin>>type[a];
        cout<<"\tTotal Order : ";cin>>totalunit[a];
      cout<<"\t---------------------\n";

            if (type[a]=='C' || type[a]=='c'){
               name[a] = "Chest";
               price[a] = 2500;}
            else if (type[a]=='T' || type[a]=='t'){
            name[a] = "Thigh";
               price[a] = 2000;}
            else if (type[a]=='W' || type[a]=='w'){
            name[a] = "Wings";
               price[a] = 1500;}
            else {
              cout<<"\nEntering incorrect code";
              price[a] = 0;}


total[a] = price[a] * totalunit[a];
chicken[x] = chicken[x]+price[a]*totalunit[a];
tax[x] = chicken[x] * 0.1;
subtotal[x] = chicken[x] + tax[x];}}


clrscr();
cout<<"\n\n\t        FRIED CHICKEN\n";
cout<<"------------------------------------------------\n";
cout<<"No.| Name of   | Unit      |  Total  | Total   |\n";
cout<<"   | Pieces    | Price     |  Unit   |         |\n";
cout<<"================================================\n";
    for (a = 1; a <= x; ++a)
   {
    cout<<" "<<a<<" | "<<name[a]<<"     | "<<price[a];
cout<<"      | "<<totalunit[a]<<"       | Rp. "<<total[a]<<endl;}


cout<<"------------------------------------------------\n";
cout<<"\t\tTotal payment        : Rp. "<<chicken[x]<<endl;
cout<<"\t\tTax 10%              : Rp. "<<tax[x]<<endl;
cout<<"\t\tSubtotal payment     : Rp. "<<subtotal[x];
cout<<"\n\n\tDo you want to order again? [Y/T] = ";
again = getche();

    if (again == 'Y' || again == 'y')
goto order;

end:
getch();
}

Post a Reply

Replies

Oldest  Newest  Rating
0 Franz Schmidt · November 23, 2014
You need to be a little more spacified. 
What exactly is your problem? (It doesn't work isn't enough.)
What errors do you get? 
And where do you have problems?
  • 1

C++

107,004 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator