Connecting Tech Pros Worldwide Help | Site Map

made the corrections, still not compiling

Member
 
Join Date: Feb 2007
Posts: 33
#1: Feb 17 '07
i have made the corrections as u directed but still is not compiling. not reading the header files. i still think the compiler is not complete. what do u think.
i need ur help.what about sending a compiler to {removed (against site rules)}
below is the corrected code


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. int main()
  8. {
  9.  
  10.     int i, j, nows, fixc, maxdemand, minprice, totmh, price,demand;
  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.     {
  25.         price = 1000+rand()%2500;
  26.         if(price<=price++)
  27.             minprice=price;
  28.         else
  29.             minprice = price++;
  30.  
  31.  
  32.  
  33.         for(j=1;j<=10;j++)
  34.         {
  35.             demand = 3000+rand()%5000;
  36.             if(demand >= demand++)
  37.                 maxdemand = demand;
  38.             else
  39.                 maxdemand = demand++;
  40.             if(maxdemand>=4000)
  41.                 totmh = 48;
  42.             else
  43.                 totmh = 24;
  44.         }
  45.         mnh= totmh/nows;
  46.         ppst= (fixc+minprice)/maxdemand;
  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);
  54.         printf("The price that will attract above max. demand = \n", ppst);
  55.     }
  56.     return 0;
  57.  
  58. }
Lives Here
 
Join Date: Sep 2006
Posts: 12,070
#2: Feb 17 '07

re: made the corrections, still not compiling


Quote:

Originally Posted by menyki

i have made the corrections as u directed but still is not compiling. not reading the header files. i still think the compiler is not complete. what do u think.
i need ur help.what about sending a compiler to {removed (against site rules)}
below is the corrected code


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. int main()
  8. {
  9.  
  10.     int i, j, nows, fixc, maxdemand, minprice, totmh, price,demand;
  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.     {
  25.         price = 1000+rand()%2500;
  26.         if(price<=price++)
  27.             minprice=price;
  28.         else
  29.             minprice = price++;
  30.  
  31.  
  32.  
  33.         for(j=1;j<=10;j++)
  34.         {
  35.             demand = 3000+rand()%5000;
  36.             if(demand >= demand++)
  37.                 maxdemand = demand;
  38.             else
  39.                 maxdemand = demand++;
  40.             if(maxdemand>=4000)
  41.                 totmh = 48;
  42.             else
  43.                 totmh = 24;
  44.         }
  45.         mnh= totmh/nows;
  46.         ppst= (fixc+minprice)/maxdemand;
  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);
  54.         printf("The price that will attract above max. demand = \n", ppst);
  55.     }
  56.     return 0;
  57.  
  58. }

What error is it giving?
Expert
 
Join Date: Nov 2006
Location: UK
Posts: 1,320
#3: Feb 17 '07

re: made the corrections, still not compiling


I compiled your code with Tubro C V3.0, Boralnd C Builder Visual C and gcc without problems - sounds as though your compiler is broken. Try downloading DEV-C++ from
http://www.bloodshed.net/devcpp.html
it is easy to use and you don't have to create a project when implementing single file programs!
Reply