第十六周项目—点结构体1

来源:互联网 发布:xampp nginx 编辑:程序博客网 时间:2024/05/18 02:45

/* 

Copyright(c)2016,烟台大学计算机学院 

 All rights reserved. 

文件名称:tset.cpp 

作者:尤文敏 

完成日期:2016年12月15日 

版本号:v1.0 

题目描述 :

  点结构体

问题及代码;

#include <stdio.h>#include <stdlib.h>#include <math.h>struct Point{    float x;  //横坐标    float y;  //纵坐标};int main(){   struct Point stu;   double s;   printf("请输入该点的坐标:");   scanf("%f %f",&stu.x,&stu.y);   s=sqrt((stu.x*stu.x)+(stu.y*stu.y));   printf("该点到坐标原点的距离是:%f",s);    return 0;}
运行结果:
知识点总结:
  在点结构体中,要注意到结构体中含有横纵坐标,其次在运用结构体中,不要忘了定义变量。
学习心得:
  学习的路上需要我们不断的探索!

0 0