#include
#include
#include
#include
#include
# define Money 500000
# define N 100
Struct xinxi
{
Char bh [30].
Char BHSTR [30].
Float jinjia.
Float shoujia;
Int kucun;
} s [N].
Void jinhuo ();
Void tuihuo ();
Void SPXS ();
Void XXCX ();
Void SPXXPX ();
Int menu ();
Int main ()
{
Printf (" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");
Printf (" welcome to simple the supermarket management system \ n ");
Printf (" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");
int n;
While (1)
{
The switch (menu ())
{
Case 1: jinhuo ();
break;
Case 2: tuihuo ();
break;
Case 3: SPXS ();
break;
Case 4: XXCX ();
break;
Case 5: SPXXPX ();
break;
Case 6: return 0;
}
}
}
Int menu ()
{
Int choice;
Printf (" \ n * * * * * * * * * * * * * * * * * * * * * * * * * * simple supermarket management system * * * * * * * * * * * * * * * * \ n ");
Printf (" 1: stock processing \ n ");
Printf (" 2: return \ n ");
Printf (" 3: commodity sales \ n ");
Printf (" 4: commodity information query \ n ");
Printf (" 5: commodity information browsing \ n ");
Printf (" 6: exit system \ n ");
Printf (" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");
Printf (" please choose corresponding number 1 ~ 6 \ n ");
Do
{
Printf (" \ n choice (1-6) : ");
The scanf (" % d ", & amp; Choice);
} while (choice<1 | | choice> 6);
Return the choice;
}
Void jinhuo ()
{
Char STR [30].
Int I, a=2, b;
B=3;
While (a==2)
{
Printf (" please enter the name of the commodity: ");
The scanf (" % s ", STR);
for(i=0; IIf (STRCMP (STR, s [I] BHSTR)==0)
{
Number: printf (" % s, purchase price: % 5. Lf, price: % 5. Lf, inventory quantity: % d \ n ", s [I] bh, s [I] jinjia, s [I] shoujia, s [I] kucun);
Printf (" please enter the number of new inventory: ");
The scanf (" % d ", & amp; S [I] kucun);
Printf (" inventory information modify complete \ n ");
break;
}
If (i>=b)
{
Printf (" add commodity information: \ n ");
Printf (" please enter the article number: ");
The scanf (" % s ", s [I] bh);
Printf (" please enter the name of commodity: ");
The scanf (" % s ", s [I] BHSTR);
Printf (" please enter the commodity purchase price: ");
The scanf (" % f ", & amp; S [I] jinjia);
Printf (" please enter the commodity price: ");
The scanf (" % f ", & amp; S [I] shoujia);
Printf (" please enter the inventory quantity: ");
The scanf (" % d ", & amp; S [I] kucun);
Printf (" commodity information added to complete, \ n ");
B++;
}
Printf (" please select: ");
Printf (" 1. Return to the start menu ");
Printf (" 2. Continue to replenish onr's stock processing ");
The scanf (" % d ", & amp; A);
}
}
Void tuihuo ()
{
Int I, a, c=2, d, b;
Char STR [30].
While (c==2)
{
Printf (" please type in the name of the commodity to return: ");
The scanf (" % s ", STR);
for(i=0; IIf (STRCMP (STR, s [I] BHSTR)==0)
{
Printf (" please input to the number of return goods: ");
The scanf (" % d ", & amp; D);
Printf (" please choose whether you want to return: ");
1. The printf (" is ");
Printf (" 2. No ");
The scanf (" % d ", & amp; A);
If (a==1)
{
S [I] [I] kucun=s kucun - d;
Printf (" return has been successfully \ n ");
}
If (s [I] kucun==0)
{
Printf (" this inventory is zero, please choose whether to delete the goods ");
1. The printf (" is ");
Printf (" 2. No ");
The scanf (" % d ", & amp; A);
If (a==1)
{
Strcpy (s [I]. Bh, "the goods does not exist");
Strcpy (s [I]. BHSTR, "the goods does not exist");
S [I] jinjia=0;
S [I] shoujia=0;
S [I] kucun=0;
Printf (" the goods have been deleted \ n ");
}
}
}
Printf (" please select: ");
Printf (" 1. Return to the start menu ");
Printf (" 2. Continued return ");
The scanf (" % d ", & amp; C);
}
}
Void SPXS ()
{
Char STR [30].
Int I, sl, a=2, c, b;
Float je, jez, ssje, zl.
Jez=0;
While (a==2)
{
Printf (" please enter the serial number of goods to buy: ");
The scanf (" % s ", STR);
for(i=0; IIf (STRCMP (STR, s [I] bh)==0)
{
Printf (" please enter to purchase quantity: ");
The scanf (" % d ", & amp; Sl);
While (sl> S [I] kucun)
{
Printf (" inventory quantity is not enough, please input again to purchase number: ");
The scanf (" % d ", & amp; Sl);
}
Printf (" receivable amount is: ");
Je=sl * s [I] shoujia;
Printf (" % 5. Lf \ n ", je);
S [I] [I] kucun=s kucun - sl;
Printf (" for the total amount receivable: ");
Jez=jez + je;
Printf (" % 5. Lf \ n ", jez);
break;
}
If (i>=b)
Printf (" I'm sorry, did not find the goods \ n ");
Printf (" please select: ");
Printf (" 1. Check out ");
Printf (" 2. To continue to purchase goods ");
The scanf (" % d ", & amp; A);
If (a==1)
{
Printf (" please enter the paid-in amount: ");
The scanf (" % f ", & amp; Ssje);
While (ssje
Printf (" amount is insufficient, please select: ");
Printf (" 1. The new payment ");
Printf (" 2. Cancel the purchase ");
The scanf (" % d ", & amp; C);
If (c==1)
{
Printf (" please enter the paid-in amount: ");
The scanf (" % f ", & amp; Ssje);
}
The else
{
Printf (" please enter cancel buy goods number: ");
The scanf (" % s ", STR);
for(i=0; IIf (STRCMP (STR, s [I] bh)==0)
{
Printf (" please enter cancel purchase quantity ");
The scanf (" % d ", & amp; Sl);
S [I] [I] kucun=s kucun + sl;
Jez=jez - sl * s [I] shoujia;
Printf (" cancel buy success \ n ");
}
}
}
Zl=ssje - jez;
Printf (" change: % 5. Lf \ n ", zl);
Printf (" buy success \ n ");
}
If (a!
=2)nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull