符号y无法解决

时间:2018-05-01 07:23:39

标签: c++ algorithm list graph

我有一个C ++问题的问题,它说它没有解决,我不明白为什么......错误在dist函数中,我不明白什么是不正确的...任何想法我能做什么?谢谢!

#include <iostream>
#include <math.h>
#include<cmath>
using namespace std;

    struct Points
    {
        float x;
        float y;
        char name[4];
    };
  float dist(Points p)
  {   return std::sqrt(p.x*p.x+p.y*p*y);
  }

int main(){
    float x,y;
    Points pt[4];
    int n=0;
        while (cin >> pt[n].name >> pt[n].x >> pt[n].y)
                 { n++;
                  if (n==5) break;

                 }
     bool execute = true;
    while (execute) {
        execute = false;
        for (int i=0; i<3; i++) {
            if (dist(pt[i]) > dist(pt[i+1])) {

                Points temp = pt[i];
                 pt[i] = pt[i+1];
                  pt[i+1] = temp;
                execute = true;
            }
        }
    }
}

1 个答案:

答案 0 :(得分:2)

你错了,需要点(。)var result = MealParser.parse(); =&gt; p.x*p.x+p.y*p*y

p.x*p.x+p.y*p.y
相关问题