Starting from:

$29

Assignment 3 Foating point numbers.

Assignment 3 Instructions
Instructions •Ensure that your code runs on remote.cs.binghamton.edu. • Prototypesmustbeprovidedforallfunctionswithintheheaderfile define.h. Definitions for all functions must be in impl.c • Youmayuse main.c foryourowntesting. Ifyouuseoutputtostandardoutput or standard error for debugging, ensure it is suppressed or removed by the time you submit. • Do complete the all and main rules in Makefile. Do not modify or remove the test, test-run, or really-clean rules in Makefile. • Code must be appropriately commented. • Useful resources: – Common Linux Commands – http://c-faq.com/ – https://cdecl.org
Questions 1. Withinafiledefine.hdefineastructure“point”thatcontainsapointinspacewith x, y and z coordinates as floating point numbers. In a file impl.c, implement a functionfloat distance(struct point p1, struct point p2) that returns the euclidean distance between points p1 and p2. (30 points) 2. Inimpl.cwriteafunctionint strrindex(char s[], char t[]),which returns the position of the rightmost occurrence of t in s, or -1 if there is none. (40 points)
1
3. Inimpl.cwriteafunctionint is int(char str[])thatacceptsacharacter array and returns 1 if the character array represents a valid integer, 0 otherwise. A valid integer is with an optional negative ’-’ character followed by 1 or more characters between 0-9 inclusive. (30 points)
2

More products