MC logo
Point Hdr File
[^] CSc 220 Home
[Introduction] [Boolean and Control] [Functions] [Arrays and Pointers] [Dynamic Arrays] [Array Errors] [Command Array] [Standard Containers] [Structs and Classes] [Automatic Pointer] [Multi-File Programs] [Copying Objects] [Templates] [Inheritance] [Plain C I/O] [Type Odds And Ends] [Plain C Strings] [File I/O]
[Point Hdr File] [Point Impl File] [Point User File] [Point Class Hdr File] [Point Class Impl File] [Point Class User File] [C++ Integer Stack ADT] [C++ Integer Stack Implementation] [C++ Integer Stack Driver]
 * C-style Header file for points.  

#ifndef _CPOINT_H_
#define _CPOINT_H_

/* Points. */
typedef struct Point {
        double xval, yval;
} Point;
/* The typedef keyword is needed in plain C, optional in C++ */

/* Operations on points */
Point mkpt(double x, double y);
double dist(Point a, Point b);
Point add(Point a, Point b);
Point sub(Point a, Point b);
void move(Point *p, double a, double b);
void print(Point p);