471,086 Members | 1,122 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,086 software developers and data experts.

Floating point formats not linked

The following C program in Turbo c is given the following error
" Floating point formats not linked abnormal program termination"

Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<math.h>
  4. #define NULL 0
  5. struct inventory
  6. {
  7.   char item[15];
  8.   float unit_price;
  9.   int count;
  10.   int quantity_received;
  11.   struct
  12.   {
  13.     int month;
  14.     int day;
  15.   }
  16.   date_received;
  17.   char supplier[15];
  18.   struct inventory *next;
  19. };
  20. main()
  21. {
  22.   struct inventory *inv_list =NULL,*p,*new_node();
  23.   char reply[10];
  24.   do
  25.   {
  26.     p = new_node();
  27.     if (p== NULL)
  28.     {
  29.       printf("Out of memory. Cannot add any more items\n");
  30.       *reply = 'n';
  31.     }
  32.     else
  33.     {
  34.       get_info(p);
  35.       add_node(p, &inv_list);
  36.       printf("\nItem %s entered.\n", p->item);
  37.       printf("\n\nDo you wish to enter another item (y/n)? ");
  38.       scanf("%s", reply);
  39.     }
  40.   }
  41.  
  42.   while (*reply == 'y'  || *reply == 'Y');
  43.   printf("\nThank you.\n");
  44.   print_inventory(inv_list);
  45. }
  46. struct inventory *new_node()
  47. {
  48.   struct inventory *malloc();
  49.   return(malloc(sizeof(struct inventory)));
  50. }
  51. get_info(node)
  52. struct inventory *node;
  53. {
  54.   printf("\tItem? ");
  55.   scanf("%s", node->item);
  56.  
  57.   printf("\tUnit price (no dollar sign)/ ");
  58.   scanf("%f", &node->unit_price);
  59.  
  60.   printf("\tQuantity received? ");
  61.   node->count = node->quantity_received;
  62.   printf("\tDate received(months/day#)? ");
  63.   scanf("%d/%d", &node->date_received.month, &node->date_received);
  64.  
  65.   printf("\tSupplier? ");
  66.   scanf("%s", node->supplier);
  67. }
  68. add_node(node, header)
  69. struct inventory *node,
  70.          **header;
  71. {
  72. node->next = *header;
  73. header = node;
  74. }
  75. print_inventory(header)
  76. struct inventory *header;
  77. {
  78.  char price[10],
  79.       date[10];
  80.       int i;
  81.       printf("\n\n%-14s%11s%17s%17s    %-14s\n",
  82.       "item", "Unit Price", "Quantity Received", "Date Received", "Supplier");
  83.       for(; header !=NULL; header = header->next)
  84.       {
  85.       sprintf(price,"$%.2f", header->unit_price);
  86.       sprintf(date,"%d/%d",
  87.       header->date_received. month, header->date_received.day);
  88.  
  89.       printf("%-14s%11s%17d%17s   %-14s\n",
  90.       header->item,price, header->quantity_received,date,
  91.       header->supplier);
  92.       }
  93.       }
Can any one suggest how to remove this error
Oct 5 '07 #1
1 1483
bartonc
6,596 Expert 4TB
I've added [code] tags and re-titled you thread in order for it to conform to our Posting Guidelines. Please take some time to learn what they are.

Thank you.

[MOVED: from the Feedback Forum]
Oct 5 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Ravi | last post: by
4 posts views Thread by Rajesh | last post: by
10 posts views Thread by Bryan Parkoff | last post: by
33 posts views Thread by dis_is_eagle | last post: by
8 posts views Thread by neha | last post: by
70 posts views Thread by Robert Gamble | last post: by
23 posts views Thread by ultimatewarrior | last post: by
39 posts views Thread by rembremading | last post: by
4 posts views Thread by mathieu | last post: by
14 posts views Thread by mathieu | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.