Please Please Help!!!!!! 
Author Message
 Please Please Help!!!!!!

I am trying to complete this little program  for an assignment but the thing
will not execute as it should, would someone out there please help and give
me some pointers?

/*
 *  Program to read in a set of floating-point TMS temperatures
 *  and to sort them into separate positive and negative arrays
 */

#include <conio.h>
#include <stdio.h>

float in_float(void);
void wait(void);

/*
 * main() function
 * ===============
 */
main()
 {
 int i=0, j=0, k=0, l=0;
 float temp, temps[20], postemps[20], negtemps[20];
 clrscr();
 cprintf("Please type in the temperatures\r\n");
 temp = in_float();
 cprintf("\r\n");
 while ((temp<=999.9) && (i<20));
  {
  int(i) = temp;
  i++;
  temp = in_float();
  cprintf("\r\n");
  }
 for (j=0; j<i; j++)
  {
  if (i>=0)
       {
       i= postemps;
       }
       else
    {
   i= negtemps;
    }
        }

 cprintf("The %i positive temperatures were:-\r\n",l);
 for (j=0; j<l; j++)
  {
  cprintf(" %f\r\n",postemps[j]);
  }
 cprintf("The %i negative temperatures were:-\r\n",k);
 for (j=0; j>l; j--)
  {
  cprintf(" %f\r\n",negtemps[l]);
  }

 wait();
 }
/*
 * end of main()
 */

/*
 * function in_float()
 * ===================
 * inputs a floating-point number from the keyboard
 */

float in_float(void)
 {
 char tbuff[12];
 float d;
 int i;
 tbuff[0] = 10;
 cgets(tbuff);
 sscanf(&tbuff[2],"%f",&d);
 return(d);
 }
/*
 * end of in_float()
 */

/*
 * function wait()
 * ===============
 * waits for a keypress
 */

void wait(void)
 {
 cprintf("\r\nPress any key to terminate");
 getch();
 }
/*
 * end of wait()
 */

Mark Pease

--



Thu, 19 Sep 2002 04:00:00 GMT  
 Please Please Help!!!!!!
Catherine Pease a crit dans le message ...
Quote:
>#include <conio.h>

Why are you again posting non standard C ? Maybe you like flammes ?

--
-hs- "Stove"
CLC-FAQ: http://www.eskimo.com/~scs/C-faq/top.html
ISO-C Library: http://www.dinkum.com/htm_cl
"It's specified. But anyone who writes code like that should be
transmogrified into earthworms and fed to ducks." -- Chris Dollin CLC
--



Sat, 21 Sep 2002 03:00:00 GMT  
 Please Please Help!!!!!!

Quote:
>  while ((temp<=999.9) && (i<20));

                                  ^
--
              /"\                              m i k e    b u r r e l l

               X        AGAINST HTML MAIL      http://mikpos.dyndns.org
              / \
--



Sat, 21 Sep 2002 03:00:00 GMT  
 Please Please Help!!!!!!
there are some strange things in this code, but :
Quote:
> while ((temp<=999.9) && (i<20));

is an empty - endless, if the conditions are true - loop
Quote:
> int(i) = temp;

this makes not much sense.
Quote:
> /*
> * function in_float()
...
> cgets(tbuff);
> sscanf(&tbuff[2],"%f",&d);

why is this? You skip 2 characters of your input.
and you use counters (l, k) for pos/neg values, but
you don't assign them.
hth,
Gerhard
--



Sat, 21 Sep 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. NEED HELP WITH PRITING AN ARRAY, PLEASE PLEASE HELP

2. PLEASE PLEASE HELP HELP...question on interleaving C functions

3. simulate dragDrop of ListView Item -- Please Please Help!!!!

4. Very Urgent !!! please please help

5. Please Please Help!!!!!!

6. PLEASE PLEASE HELP

7. Please Please Help! - pointer notation

8. Please please help a

9. Please please help a newbie!!

10. Please please help a newbie!!

11. Please, please help

12. About resizing ActiveMovie ActiveX control, please please help!

 

 
Powered by phpBB® Forum Software