473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 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 1708
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

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

Similar topics

3
by: Ravi | last post by:
Is there anything wrong with this program? #include <stdio.h> int main() { struct emp { char name; float sal;
4
by: Rajesh | last post by:
struct symbol { char ch; float probability; char *codeword; }; void get_user_input(struct symbol **sptr) { .....
10
by: Bryan Parkoff | last post by:
The guideline says to use %f in printf() function using the keyword float and double. For example float a = 1.2345; double b = 5.166666667; printf("%.2f\n %f\n", a, b);
33
by: dis_is_eagle | last post by:
hi....i have encountered strange problem regarding floating point comparison...the problem is... main() { float a=0.7; if(0.7 a) printf("hi"); else printf("hello");
8
by: neha | last post by:
hi Its been Given that Which error are you likely to get when you run the following program? main() { struct emp { char name;
70
by: Robert Gamble | last post by:
9899:1999 5.1.2.3 Example 4 reads: "EXAMPLE 4 Implementations employing wide registers have to take care to honor appropriate semantics. Values are independent of whether they are represented in a...
23
by: ultimatewarrior | last post by:
Hi all, first of all I beg your pardon if this question has been asked before, but I was unable to find anything in the past posts. I have written a piece of code that was supposed to be quite...
39
by: rembremading | last post by:
Hi all! The following piece of code has (for me) completely unexpected behaviour. (I compile it with gcc-Version 4.0.3) Something goes wrong with the integer to float conversion. Maybe somebody...
4
by: mathieu | last post by:
Hello, Has anyone heard of the 'half' floating point type. That would be a 16bits floating point, see for example: http://oss.sgi.com/projects/ogl-sample/registry/ARB/half_float_pixel.txt ...
14
by: mathieu | last post by:
hi there, I do not understand the syntax for ios_base::precision. Let say I have a floating point: const float f = 0.313244462; How do I write is to a stream ? const float f =...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.