可以编译,就是运行失败.请问哪里出问题了.
所示的程序在屏幕上打印函数F(y)=e-y*sin(2πy)的曲线。
#include <stdio.h>
#include <math.h>
#define DELTA 0.0625 //打印每一行y值改变的步长
#define PI 3.14159
#define LINE 30 //总共打印30行
#define WIDTH 80 //每行最多打印80列
#define RATE 40 //将计算出的F(y)值转换成相应的列数的比例因子
#define BASE 30 //F(y)=0时,在第30列打印
void main()
{
int i, j, n;
double x, y;
char array[WIDTH];
y = 0.0;
for (j=0; j <= WIDTH-1; j++)
array[j] = ' ';
for (i=1; i <= LINE; i++)
{
array[BASE] = '|';
x = exp(-y)*sin(2*PI*y);
n = (int)(RATE*x)+BASE;
array[n] = '*';
for (j=0; j <= WIDTH-1; j++)
printf("%c", array[j]);
printf("\n");
array[n] = ' ';
y += DELTA;
}
}
--------------------Configuration: 0555 - Win32 Debug--------------------
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/0555.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.
0555.exe - 1 error(s), 0 warning(s)