473,564 Members | 2,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

debugging a price and demand program

33 New Member
am writing a program to determine the best price that will attract maximum demand. first i had to generate random number to enable me determine the price and quantity demanded at the particular price.
my problem is that the program has alot of errors. can u help me debug, please!!! i need it urgently. such error include unable to load include file stdio.h and so on. the source code is as shown below



Expand|Select|Wrap|Line Numbers
  1. /* programe to solve mr jones problem. by odo emeka*/
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <time.h>
  6.  
  7. intmain()
  8. {
  9.  
  10.     int i, j, NOWS, FIXC, Maxdemand, Minprice, Totmh;
  11.     float PPST, Mnh;
  12.     srand (time(NULL) );
  13.  
  14.     printf("Enter Number of workers:");
  15.     scanf("%d", &NOWS);
  16.     printf("Enter fixed cost:");
  17.     scanf("%d", &FIXC);
  18.         IF(NOWS>24)
  19.             printf("Enter Number less than or equal to 24");
  20.         else
  21.             printf("\n");
  22.  
  23.     FOR (i=1;i<=10;i++){
  24.         price[i] = 1000+(rand()%2500)
  25.             IF(price[i]<=price[i++]
  26.                 Minprice=price[i];
  27.             else
  28.                 Minprice = price[i++];
  29.  
  30.     {
  31.  
  32.     FOR(j=1,j<=10,j++){
  33.         demand[j] = 3000+(rand()%5000
  34.             IF(demand[j] >= demand[j++])
  35.                 Maxdemand = demand[j];
  36.             else
  37.                 Maxdemand = demand[j++];
  38.                     IF(Maxdemand>=4000)
  39.                         Totmh = 48;
  40.                     else
  41.                         Totmh = 24;
  42.     }
  43.  
  44.     Mnh = Totmh/NOWS;
  45.     PPST = (FIXC+Minprice)/Maxdemand;
  46.  
  47.     printf("\n\n");
  48.     printf("Total number of workers in the company\n",NOWS);
  49.     printf("The fixed cost of production = \n", FIXC);
  50.     printf("The variable cost = \n", Minprice);
  51.     printf("The max. demand attracted by the above costs = \n", Maxdemand);
  52.     printf("The total men hour involved in the production = \n", Totmh);
  53.     printf("Total hourly input for each workers = \n",Mnh "hours");
  54.     printf("The price that will attract above max. demand = \n", PPST);
  55.  
  56.     Return 0
  57. }

Feb 15 '07 #1
1 1500
Ganon11
3,652 Recognized Expert Specialist
Please post the exact list of errors you are receiving - it will help us immensely to find and help correct your errors.
Feb 15 '07 #2

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

Similar topics

25
4270
by: Jeff | last post by:
Use the MS Script Editor included free with MS Office 2002 and above, for debugging Internet Explorer (IE). This subject is of great interest to many JS developers, as there is no obvious, low cost way to do sophisticated debugging in IE6 other than to use the debugger described below, which is horribly documented otherwise. I feel...
1
2373
by: pauldepstein | last post by:
I am trying to debug a program with the Bloodshed dev c++ compiler. The program tries to use a recursive function to price financial options. It compiles but I get a memory violation when I run it. When I run it through the debugger, using watch variables, ofstream tritree_basic("tritree_basic_data.txt",
12
1617
by: pauldepstein | last post by:
I am debugging a program to price options which involves a recursive function: double node::get_equity(Parameter * const params_ptr, int x, int y, const int rights) This recursive function is behaving oddly. I made it print statements into a debug file to try and capture the anomalous behaviour, and I did capture something that to me...
13
1595
by: Arne Garvander | last post by:
Sometimes I get an exception in the browser and I get prompted to start Visual Studio 2005 for debugging. Sometimes I would like to start client side debugging on demand. How can I do that? -- Arne Garvander (I program VB.Net for fun and C# to get paid.)
83
3901
by: achintmehta | last post by:
I am working on MontaVista Linux on a PPC board. The compiler I am using is a gnu cross compiler cross compiler (ppc-82xx-gcc) The application/software that is being run, is messing up the memory due to which a subsequent malloc fails. When the application core is dumped I do not get any backtrace in the code (although the application is...
0
1139
by: krystian | last post by:
Hello, I've been following the previous thread "Windows Service Starts and Immediately Stops" and I have a similar problem. I've been trying to get started on a windows service and have followed the following rather well known tutorial (I also make some references to it in this writeup):
2
2401
by: Diez B. Roggisch | last post by:
Hi, I'm fiddling around with pydb. Installation and usage are fine. What I especially like is the fact that you can attach a signal such that you drop into debugging mode on demand. But this is of limited use to me in situations where a server is written in python. According to the source, pydb's debugger class Gdb extends cmd.Cmd. It...
0
7312
jwwicks
by: jwwicks | last post by:
Introduction This tutorial describes how to use Visual Studio to create a new C++ program, compile/run a program, resume work on an existing program and debug a program. It is aimed at the beginning CIS student who is struggling to get their programs working. I work in the computer lab at the college I'm attending and I see many students who...
2
20828
jwwicks
by: jwwicks | last post by:
C/C++ Programs and Debugging in Linux This tutorial will give you a basic idea how to debug a program in Linux using GDB. As you are aware Visual Studio doesn’t run on Linux so you have to use some of the tools provided on the command-line. If you hate the command line tools, get over it since you’re bound to be using them at some point in your...
0
7665
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7583
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5484
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.