getpoints.c

来自「Travelling saleman by C++」· C语言 代码 · 共 33 行

C
33
字号
/* *  getpoints.c *   * Phil Cox, B00XXXXXX * Login: pcox * CSCI2132: Assignment 3 * */#include <stdlib.h>#include <stdio.h>#include "list.h"struct node *getpoints(void){	/* Read coordinates from standard input 	   and construct a linked list of points */		struct node *points=NULL, *new;	double x, y;		while(scanf("%lf%lf",&x,&y) != EOF)		if ((new = malloc(sizeof(struct node))) == NULL)			return(NULL);		else {			new->x = x;			new->y = y;			new->next = points;			points = new;		}	return(points);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?