#include<stdio.h>
#include<conio.h>
#include<string.h>
#define N 10
void dummy(float *a)
{
float b=*a;
//perform some floating access
dummy (&b);
//calling a floating point function
}
struct product{
int pid;
char pname[20] , mfd[11], sname[20];
float price;
};
void main() {
int i;
struct product p[N];
for (i=0;i<N;i++){
clrscr();
printf("Enter %d product detail:-\n",i+1);
printf("Enter product id number\n");
scanf("%d",&p[i].pid);
getch();
printf("Enter product name\n");
fflush(stdin);
gets(p[i].pname);
getch();
printf("Enter product's manufacturing date\n");
fflush(stdin);
gets(p[i].mfd);
getch();
printf("Enter suplier name\n");
fflush(stdin);
gets(p[i].sname);
getch();
printf("Enter price\n");
scanf("%f",&p[i].price);
getch();
}
for (i=0;i<N;i++) {
clrscr();
printf("\nDetails of %d product:-\n",i+1);
printf("Product id=%d\n Product Name=%s\n Manufacturing date=%s\n Suplier name=%s\n Price=%f\n",p[i].pid,p[i].pname,p[i].mfd,p[i].sname,p[i].price);
getch();
}
}
No comments:
Post a Comment