#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
int manu;
char date[10][100],s_date[10][100];
float p_liter[100],s_liter[100];
int loop=1;
int p=0,s=0,n;
float p_liter_total, s_liter_total;
float p_bpl[100], p_total[100], s_bpl[100], s_total[100], gas_balance, s_remaining_cost[100], p_remaining_cost_total, p_remaining_cost[100],s_remaining_cost_total;
while (loop != 0)
{
printf(" \n Manu: \n");
printf("1.Purchase Entry\n");
printf("2.Sale Entry\n");
printf("3.Summary\n");
printf("4.Exit\n");
printf("Type Number: ");
scanf("%d", &manu);
if (manu == 1)
{
printf("Purchase Date : ");
scanf("%s", date);
printf("Liters : ");
scanf("%d", &p_liter[p]);
printf("Baht/Liter : ");
scanf("%f", &p_bpl[p]);
printf("Total : %f", p_total[p] = p_liter[p] * p_bpl[p]);
p++;
}
else if (manu == 2)
{
printf("Sale Date : ");
scanf("%s", s_date);
printf("Liters : ");
scanf("%d", &s_liter[s]);
printf("Baht/Liter : ");
scanf("%f", &s_bpl[s]);
printf("Total : %f", s_total[s] = s_liter[s] * s_bpl[s]);
s++;
}
else if (manu == 3)
{
for (n = 0; n <= p; n++)
{
p_liter_total = p_liter_total + p_liter[n];
}
n = 0;
for (n = 0; n <= s; n++)
{
s_liter_total = s_liter_total + p_liter[n];
}
n = 0;
gas_balance = p_liter_total - s_liter_total;
n = 0;
printf("Gas Balance: %f ", &gas_balance);
for (n = 0; n <= p; n++)
{
p_remaining_cost[n] = p_liter[n] * p_bpl[n];
printf("%s %f@%f total of %f\n", date[n], p_liter[n], p_bpl, p_remaining_cost[n]);
}
for (n = 0; n <= p; n++)
p_remaining_cost_total = p_remaining_cost_total + p_remaining_cost[n];
printf("Net remaining cost: %f \n", &p_remaining_cost_total);
printf("Sale Report: \n");
for (n = 0; n <= s; n++)
{
s_remaining_cost[n] = s_liter[n] * s_bpl[n];
printf("%s %f@%f total of %f\n", s_date[n], s_liter[n], s_bpl, s_remaining_cost[n]);
}
for (n = 0; n <= p; n++)
s_remaining_cost_total = s_remaining_cost_total + s_remaining_cost[n];
printf("Net pofit: %f \n", &s_remaining_cost_total);
}
else if (manu == 4)
{
printf("=====Thank You======\n");
}
else
loop = 0;
}
system("pause");
}