Miscellaneous > Programming & Networking

A programming challenge all up in your face.

<< < (18/24) > >>

worker201:
Just started my new job, so I haven't had much spare time to mess with this yet.  But I have a plan to deal with vertical lines and tangents that I think will be cool.  I also want to recast everything as doubles, just to see what the change is.

mobrien_12:
#include
#include
#include
#define TRUE 1
#define FALSE 0

int main()
{
  /* variable declarations */
 
  /* file read/write variables */
 
  typedef int bool;
  bool transpose;
  /* temporary "shuffle" variable used to transpose coordinates */
  float tempcoord;
  /* variables declared from input */
  float x1, y1, x2, y2;
  int i, numcirc;
  float circlex[15], circley[15], radius[15];
  /* variables for internal use */
  float slope, yint, rsquare, discrim, theta;
  float aterm, bterm, cterm;
  float u, j, v, w, high, low;
  float total, chord, arc;
  float intx1[15], intx2[15], inty1[15], inty2[15];

mobrien_12:
Modified worker's program to take care of vertical lines... the tangent's still need to be done.  Don't think I can do that...

It works :)

Tested with this data

--- Code: ---
5
0
5
10
2
5 5 1
20 20 2

--- End code ---


CAN'T POST THE CODE..... CAN'T FIGURE OUT WHAT'S MAKING IT BARF.... there's no f  open in there.

GAH

I left some troubleshooting printf statements in there.... sorry it's getting late.  I also commented out the scanfs becasue I didn't want to type in the file names while troubleshooting... easy enought to uncomment them.

[verwijderd door de beheerder]

Lead Head:
Wow

worker201:
What an exciting Friday night, programming in C.  :cool:

Here's my latest version:
http://www.triple-bypass.net/download/circleline2.txt

It deals with vertical lines and tangents, and even has a function!

Too bad it doesn't work.

For some reason, my logically flawless method of catching tangents doesn't seem to work.  Here's the data I tested with:
0
5
10
5
1
5 6 1

Overall, the whole program doesn't work.  It ends up writing "nan" to the output file.  Which makes me think that there is something really screwy going on.  Notice that all the floats are now doubles - could that be to blame?  Or maybe it's the function not returning properly.  Honestly, the thing I find most difficult about programming, by far, is understanding variable scope.  It seems like it would be so much easier to just have the function use the same variables the program does.  Any suggestions?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version