Search
 
SCRIPT & CODE EXAMPLE
 

C

C Program to Maintain an Inventory of items in Online Store

#include <stdio.h>
#include <conio.h>
void main() {
    struct date {
		int day;
		int month;
		int year;
	};
	struct details {
		char name[20];
		int price;
		int code;
		int qty;
		struct date mfg;
	};
	struct details item[50];
	int n,i;
	clrscr();
	printf("Enter number of items:");
	scanf("%d",&n);
	fflush(stdin);
	for (i=0;i<n;i++) {
		fflush(stdin);
		printf("Item name:");
		scanf("%[^
]",item[i].name);
		fflush(stdin);
		printf("Item code:");
		scanf("%d",&item[i].code);
		fflush(stdin);
		printf("Quantity:");
		scanf("%d",&item[i].qty);
		fflush(stdin);
		printf("price:");
		scanf("%d",&item[i].price);
		fflush(stdin);
		printf("Manufacturing date(dd-mm-yyyy):");
		scanf("%d-%d-%d",&item[i].mfg.day,&item[i].mfg.month,&item[i].mfg.year);
	}
   printf("             *****  INVENTORY *****
");
   printf("------------------------------------------------------------------
");
   printf("S.N.|    NAME           |   CODE   |  QUANTITY |  PRICE  |MFG.DATE
");
   printf("------------------------------------------------------------------
");
   for (i=0;i<n;i++)
      printf("%d   %-15s   %-d  %-5d  %-5d %d/%d/%d
",i+1,item[i].name,item[i].code,item[i].qty,item[i].price,item[i].mfg.day,item[i].mfg.month,item[i].mfg.year);
	printf("------------------------------------------------------------------
");
	getch();
}
Comment

C Program to Maintain an Inventory of items in Online Store

#include <stdio.h>
#include <conio.h>
void main() {
    struct date {
		int day;
		int month;
		int year;
	};
	struct details {
		char name[20];
		int price;
		int code;
		int qty;
		struct date mfg;
	};
	struct details item[50];
	int n,i;
	clrscr();
	printf("Enter number of items:");
	scanf("%d",&n);
	fflush(stdin);
	for (i=0;i<n;i++) {
		fflush(stdin);
		printf("Item name:");
		scanf("%[^
]",item[i].name);
		fflush(stdin);
		printf("Item code:");
		scanf("%d",&item[i].code);
		fflush(stdin);
		printf("Quantity:");
		scanf("%d",&item[i].qty);
		fflush(stdin);
		printf("price:");
		scanf("%d",&item[i].price);
		fflush(stdin);
		printf("Manufacturing date(dd-mm-yyyy):");
		scanf("%d-%d-%d",&item[i].mfg.day,&item[i].mfg.month,&item[i].mfg.year);
	}
   printf("             *****  INVENTORY *****
");
   printf("------------------------------------------------------------------
");
   printf("S.N.|    NAME           |   CODE   |  QUANTITY |  PRICE  |MFG.DATE
");
   printf("------------------------------------------------------------------
");
   for (i=0;i<n;i++)
      printf("%d   %-15s   %-d  %-5d  %-5d %d/%d/%d
",i+1,item[i].name,item[i].code,item[i].qty,item[i].price,item[i].mfg.day,item[i].mfg.month,item[i].mfg.year);
	printf("------------------------------------------------------------------
");
	getch();
}
Comment

PREVIOUS NEXT
Code Example
C :: how to write flash memory in stm32f030 
C :: send data to port in c 
C :: how to limit tiktok on mikrotik 
C :: int main() { int sum =0; FILE * ptr; ptr = fopen("d:students. "," "); if (ptr ==NULL){ ("file does not exist!!"); exit(0); } 
C :: Uri/beecrowd problem no - 1131 solution in C 
C :: asasz 
C :: check if string is number c 
C :: djb2 algorithm for C 
C :: c "hello world" 
C :: which one is faster loop or recursive function? 
C :: C Common mistakes when working with pointers 
C :: garbage collection and dangling reference 
C :: logarithmus c math.h 
C :: copy a number of characters to another string in c without standard library 
C :: how to add a number before every line in c language 
C :: buildCheckFunction(locations) 
C :: how to compress image in c 
C :: how to write 2d array from bin file in c 
C :: error: dereferencing pointer to incomplete type 
C :: bucket sort 
C :: C printf Declaration 
C :: 4k stogram chave 
Dart :: How to attach a FloatingActionButton to the AppBar 
Dart :: flutter lock screen to portrait mode 
Dart :: switch to another flutter channel eg. $ flutter channel beta $ flutter channel stable 
Dart :: flutter return empty widget 
Dart :: flutter cliprrect 
Dart :: dart string empty or null 
Dart :: flutter url image 
Dart :: dart try-catch 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =