回复 2# 的帖子
哦,谢谢!矩阵a为10维方阵,i,j为下标,当i=j时,其对应值为sin(0.2i+0.5j),否则为cos(0.3i+0.4j),怎么给a初始化,我编的,运行不了...这回学乖了,在线等,再次感谢
#include "math.h"
#include "stdio.h"
main()
{int i,j;
static double a[10][10];
for(i=0;i<=9;i++)
{for(j=0;j<=9;j++)
{if(i=!j)
a[i][j]=cos(0.3i+0.4j);
else
a[i][j]=sin(0.2i+0.5j);
}
}
for(i=0;i<=9;i++)
{for(j=0;j<=9;j++)
{printf("a=%13.7e\n",a[i][j]);
printf("\n");}
}
}