Академический Документы
Профессиональный Документы
Культура Документы
h>
#include<conio.h>
void record();
void display();
void cost();
void price();
void quantity();
void avgcost();
void avgprice();
int ch;
int no;
int no2;
int i;
int c;
int quant = 0;
struct inventary{
char name[20];
int cost;
int quantity;
int price;
}t1;
int main()
do
{
printf("\n\tWELCOME TO NABEEL INVENTORY SYSTEM\n");
printf("\n");
printf("\n");
scanf("%d", &ch);
switch (ch)
case 1: record();
break;
case 2: display();
break;
case 3: cost();
break;
case 4: price();
break;
case 5: quantity();
break;
case 6: avgprice();
break;
case 7: avgcost();
break;
case 8:
break;
break;
system("cls");
return(0);
void record()
scanf("%d", &no);
FILE *fp;
fp = fopen("nabeel.txt", "w");
scanf("%s", t1.name);
scanf("%d", &t1.cost);
printf("Enter the Product Quanitity\n");
scanf("%d", &t1.quantity);
scanf("%d", &t1.price);
fclose(fp);
void display()
FILE *fp;
fp = fopen("nabeel.txt", "r");
printf("%c", c);
fclose(fp);
getch();
system("cls");
void cost()
int totalcost = 0;
FILE *fp;
fp = fopen("nabeel.txt", "r");
scanf("%d", &no);
fclose(fp);
getch();
system("cls");
void price()
int total = 0;
scanf("%d", &no);
FILE *fp;
fp = fopen("nabeel.txt", "r");
fclose(fp);
getch();
system("cls");
void quantity()
scanf("%d", &no);
FILE *fp;
fp = fopen("nabeel.txt", "r");
fclose(fp);
getch();
system("cls");
void avgprice()
{
int avg;
int t = 0;
scanf("%d", &no);
FILE *fp;
fp = fopen("nabeel.txt", "r");
t = t + t1.price;
avg = t/no;
fclose(fp);
getch();
system("cls");
void avgcost()
int costavg = 0;
int costtotal = 0;
FILE *fp;
fp = fopen("nabeel.txt", "r");
scanf("%d", &no);
{
fscanf(fp, "PRODUCT NAME : %s\n", &t1.name);
costavg = costtotal/no;
fclose(fp);
getch();
system("cls");