变换-麻烦各位帮我改下程序吧,输入#include "stdafx.h"在VC++上面不能运行呀~~

问题描述

麻烦各位帮我改下程序吧,输入#include "stdafx.h"在VC++上面不能运行呀~~
#include ""stdafx.h""
#include

#include

#include

#include
#include
#define N 1000

/*定义复数类型*/

typedef struct

{

double real;

double img;

}complex;

void fft(); /*快速傅里叶变换*/

void ifft();

void initW(); /*初始化变换核*/

void change(); /*变址*/

void add(complex complex complex ); /复数加法*/

void mul(complex complex complex ); /复数乘法*/

void sub(complex complex complex ); /复数减法*/

void divi(complex complex complex );/复数除法*/

void output();
/*输出结果*/

complex x[N] W; /变换核*/

int size_x=0; /*输入序列的大小,在本程序中仅限2的次幂*/

double PI=atan(1)*4; /*定义圆周率*/

int main()

{

int i X Yflt=0;
int gd=DETECTgm;
system(""cls"");

printf(""输入正弦频率X:n"");

scanf(""%d""&X);

printf(""输入采样频率Y(理想情况下应是2的整数次幂):n"");

scanf(""%d""&Y);
if(int(Y)==2||int(Y)==4||int(Y)==8||int(Y)==16||int(Y)==32||int(Y)==64||int(Y)==128||int(Y)==256||int(Y)==512||int(Y)==1024)
flt=1;
if(flt==0)
{ printf(""注意!输入的Y不是2的整数次幂!n"");

}

printf(""输入采样点数size_x:n"");
scanf(""%d""&size_x);

for(i=0;i<size_x;i++)
{
x[i].real=sin(2*PI*X*i/Y);
x[i].img=0;
}
initW();

fft();

output();
for(i=0;i<size_x;i++)
{ //求变换后结果的模值,存入复数的实部部分
x[i].real=sqrt(x[i].real*x[i].real+x[i].img*x[i].img);
}
//registerbgidriver(EGAVGA_driver);
initgraph(&gd&gm");
cleardevice();
setcolor(WHITE);
line(40040040050);
line(4005039555);
line(4005040555);
line(200400600400);
line(600400595395);
line(600400595405);
setcolor(WHITE);
for(i=0;i<size_x;i++)
line(i*10+400-size_x*10/2400i*10+400-size_x*10/2400-(int)x[i].real*10);
getch();
closegraph();
return 0;

}

/*快速傅里叶变换*/

void fft()

{

int i=0j=0k=0l=0;

complex updownproduct;

change();

for(i=0;i< log(size_x)/log(2) ;i++)/*一级蝶形运算*/

{

l=1<<i;

for(j=0;j<size_x;j+= 2*l )/*一组蝶形运算*/

{

for(k=0;k<l;k++)/*一个蝶形运算*/

{

mul(x[j+k+l]W[size_x*k/2/l]&product);

add(x[j+k]product&up);

sub(x[j+k]product&down);

x[j+k]=up;

x[j+k+l]=down;

}

}

}

}

/*初始化变换核*/

void initW()

{

int i;

W=(complex *)malloc(sizeof(complex) * size_x);

for(i=0;i<size_x;i++)

{

W[i].real=cos(2*PI/size_x*i);

W[i].img=-1*sin(2*PI/size_x*i);

}

}

/*变址计算,将x(n)码位倒置*/

void change()

{

complex temp;

unsigned short i=0j=0k=0;

double t;

for(i=0;i {
k=i;j=0;
t=(log(size_x)/log(2));
while( (t--)>0 )

{

j=j< j|=(k & 1);
k=k>>1;

}

if(j>i)

{

temp=x[i];

x[i]=x[j];

x[j]=temp;

}

}

}

/*输出傅里叶变换的结果*/

void output()

{

int i;

printf(""The result are as followsn"");

for(i=0;i {
printf(""%.4f""x[i].real);
if(x[i].img>=0.0001)

printf(""+%.4fjn""x[i].img);

else if(fabs(x[i].img) printf(""n"");
else
printf(""%.4fjn""x[i].img);
}
}
void add(complex acomplex bcomplex *c)
{
c->real=a.real+b.real;

c->img=a.img+b.img;

}

void mul(complex acomplex bcomplex *c)

{

c->real=a.real*b.real - a.img*b.img;

c->img=a.real*b.img + a.img*b.real;

}

void sub(complex acomplex bcomplex *c)

{

c->real=a.real-b.real;

c->img=a.img-b.img;

}

void divi(complex acomplex bcomplex *c)

{

c->real=( a.real*b.real+a.img*b.img )/( b.real*b.real+b.img*b.img);

c->img=( a.img*b.real-a.real*b.img)/(b.real*b.real+b.img*b.img);

}

解决方案

新建一个控制台程序,然后把这些代码粘贴进去,编译。
贴出报的错误来

解决方案二:
不能运行,具体是什么情况呢?编译无法通过,还是运行没在得到想要的结果?

是否要包含预编译头文件:#include ""stdafx.h"",是由工程的属性决定的。

解决方案三:
你选择的是win32的工程?目测你的代码用控制台的共成功就可以了

解决方案四:
新建空白的程序能编译么?如果还不能,就考虑重装VC++吧。

解决方案五:
在这里下载原版的看看
http://download.csdn.net/album/detail/639

解决方案六:
再不行,去msdn.itellyou.cn下载原版的Windows操作系统,重新安装

时间: 2024-08-03 15:59:35

变换-麻烦各位帮我改下程序吧,输入#include &amp;quot;stdafx.h&amp;quot;在VC++上面不能运行呀~~的相关文章

麻烦大家帮我看看下面的sql问题?

问题描述 麻烦大家帮我看看下面的sql问题? select distinct a.* from a,b where to_char(a.reg_date,'yyyy-mm-dd') >= '2015-08-10' and to_char(a.reg_date,'yyyy-mm-dd') < '2015-08-11' and a.card_no = b.card_no and a.dept_name is not null and a.dept_name <> '.' and a.v

python-大神帮我改一下程序吧。去掉第一个逗号后内容重复的行。只保留一条

问题描述 大神帮我改一下程序吧.去掉第一个逗号后内容重复的行.只保留一条 #!/usr/bin/python -*- coding: utf-8 -*- 原文本里边有重复的,去重复行 import requchong = open('G:07txtchongfuhang.txt''r').readlines()quchonghou = open('G:07txtchongfuhanghou.txt''w') unique_quchong = []for each_line in quchong:

c++-有哪位哥哥姐姐可以帮我写下程序(关于二叉树的 或者栈)

问题描述 有哪位哥哥姐姐可以帮我写下程序(关于二叉树的 或者栈) 那个运用c++编写两个程序,其中一个是实现二叉树(或者栈),另一个是运用二叉树(或者栈)解决实际问题.谢谢啦,实在是没搞懂. 解决方案 /** <!-- File : stack.h Author : fancy Email : fancydeepin@yeah.net Date : 2013-02-03 --!> */ #include #include #include #define Element char #defin

c++-我调用opencv中的函数计算出的hu矩没有旋转、缩放不变性,请大家帮我看下程序哪出问题了。

问题描述 我调用opencv中的函数计算出的hu矩没有旋转.缩放不变性,请大家帮我看下程序哪出问题了. #include #include #include using namespace std; using namespace cv; int main(int argc, char *argv[]) {//读入图片预处理 Mat image=imread("F:vs2010 project21.jpg"); //image.create(480, 640, CV_8UC1); na

python 大神帮我看下程序,怎么前边时间加载错误

问题描述 python 大神帮我看下程序,怎么前边时间加载错误 解决方案 你其实可以直接判断在不在unique_quchong中后,如果不在,直接把当前行一整行写入文件就可以了.

这个一维怎么改成2维!大家帮我改下!!!

问题描述 这个一维怎么改成2维!大家帮我改下!!!List<string>list=newList<string>();if(rslt.结果.ChildNodes.Count>0){for(i=0;searcher.返回字段List.Length;i++){foreach(XmlElementelementinrslt.结果.ChildNodes){if(((XmlCDataSection)element.ChildNodes[1].FirstChild).Value==&q

|M| 300分 SQL存储过程没有学过 麻烦大家帮我改一下存储过程让他能够不按主键排序

问题描述 下面的是我现在用的分页存储过程但这里只能按主建进行排序现在我的表有一个日期字段 我想要在下面的参数@Col为SaleDate的时候进行日期排序要怎么改谢谢SETQUOTED_IDENTIFIEROFFGOSETANSI_NULLSOFFGOALTERPROCEDURESP_Page@TBVARCHAR(1000), --表名@COLVARCHAR(1000),--主键--@COLTYPEINT,@ORDERBYBIT,--是否Desc排序@COLLISTVARCHAR(3000),--

谁能帮我改下这个样式吗?老板在催了 最后一天了。。求大神赐教

问题描述 <divstyle="position:relative;top:0px;left:0px;display:inline;"><spanstyle="margin-left:100px;display:inline;width:18px;overflow:hidden;"><asp:DropDownListID="dropDownListControl"Style="width:118px;mar

下面的代码使帮我写下程序啊

问题描述 namespaceMyCryptoHelp{///<summary>///异常处理类///</summary>publicclassCryptoHelpException:ApplicationException{publicCryptoHelpException(stringmsg):base(msg){}}///<summary>///CryptHelp///</summary>publicclassCryptoHelp{privatecons