SHARE
TWEET

Untitled

a guest Jun 19th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ifndef WEI_h
  2. #define WEI_h
  3.  
  4. /*WEI contains two objects:
  5.  
  6. /* a number, which is identified by itself.*/  
  7. typedef int number;
  8.  
  9. /* a point, which is identified by name (a string).*/
  10. /*the point also contains x and y coordinates, which are numbers. */
  11. typedef struct{
  12.     char * name;
  13.     number x;
  14.     number y;
  15. }point;
  16.  
  17. /*WEI can be any type of data structure - an array, binary tree ot linked list.*/
  18. typedef struct WEI;
  19.  
  20. /*the function receives no parameters, and returns a pointer to WEI.*/
  21. WEI* createWEI();
  22.  
  23.  
  24. /*the function receives int, which is the number the user wants to add to the WEI (which was created in the previous function).
  25. The function does not return anything.*/  
  26. void addNumberToWEI(WEI*, int);
  27.  
  28. /*the function receives char* (a string), which is the identifier (the name) of the point the user wants to add to the WEI,
  29. the two numbers that the point will conatin as x and y coordinates, and a pointer to that WEI, which was created in the previous function.
  30. The function does not return anything.*/  
  31. void addPointToWEI(WEI*, char*, number, number);
  32.  
  33. /*the function receives a pointer to WEI, and three char* (three strings), which are the identifiers (the names) of the three points.
  34. The function checks if the points are colinear.
  35. The function returns and int - different number for each result (1. they are colinear. 2. they are not. 3. one (or more) of the points does not exist in the WEI struct. */  
  36. int isCoLinear(WEI*, char*, char*, char*);
  37.  
  38.  
  39. /*the function receives a pointer to WEI, and two char* (two strings), which are the identifiers (the names) of the two points.
  40. The function calculates the slope of the line connecting the points.
  41. The function returns the slope or any other value if one of the points does not exist in the WEI struct. */
  42. double SlopeWEI(WEI*, char*, char*);
  43.  
  44. /*the function receives a pointer to WEI, and a number k.
  45. The function returns all the points which contain the number k. The return data type can be of any type - an array, linked list or a tree. */
  46. point* PointsContainK(WEI*, number);
  47.  
  48. /*the function receives a pointer to WEI, frees the struct and does not return anything.*/
  49. void destroyWEI(WEI*);
  50.  
  51.  
  52. #endif WEI_H
RAW Paste Data
Want to get better at C?
Learn to code C in 2017
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top