[其他] 编c++的时候结果不对,麻烦高手出面相助!

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

void fkt(double x[2], double f[2])
{
      f[0] = x[1];
      f[1] = 2*x[0];
      //cout<<f[0]<<" "<<f[1]<<endl;
}
void norm(double x[2],double j)
{   
     double t[2];
     fkt(x,t);
     j=t[1];
     cout<<"!!!!!!!!! "<<t[0]<<" !!!!!! "<<t[1]<<endl;
}

int main()
{
    double x[2] ; double j;
    x[0]=3.0;
    x[1]=1.0;
    norm(x,j);    个人觉得问题可能出在这个函数,因为 j 返回出来一个随机值。
    cout<<"%%%%%%"<<j<<endl;
    system("pause");
    return 0;
}
哪位高手帮忙看看,我的目的就是想对x进行逐相求模。
多谢了先

TOP