Q.......A parts inventory record contains the following fields:
• record code, (only code 11 is valid)
• part number (6 characters; 2 alpha and 4 numeric, e.g. AA1234),
• part description, and
• inventory balance
Design an algorithm that will read the file of parts inventory records, validate the record code and part number of each record, and print the details of all valid inventory records which have an inventory balance equal to zero.
C-CODE:
printf("enter record code:\n,part number:\n,invent_bal:\n");
scanf("%d%d%d",&recrd_cde,&prt_no,&invent_bal);
do
{
if(recrd_cde==11)
{
if(prt_no==ch[6])
{if(invent_bal==0);
{
printf("%d%d%d%d are deatails\n",recrd_cde,prt_no,prt_desc,invent_bal);
}
}
}
else
{
if(recrd_cde!=11)
{
if(prt_no!=ch[6])
{
if(invent_bal!=0)
{
printf("inventory record is not valid\n");
}
}
}
printf("want to enter more records?:y/n\n "); }
while(cnt=='y');
system("pause"); } ....//SYNTAX ERROR AT END OF INPUT
Comments
Leave a comment