c程序设计谭浩强第四版(谭浩强第四版C语言程序设计课后习题答案有哪些)

本文目录
谭浩强第四版C语言程序设计课后习题答案有哪些
第1章程序设计和C 语言1
1.1什么是计算机程序1
1.2什么是计算机语言1
1.3C 语言的发展及其特点3
1.4最简单的C 语言程序5
1.4.1最简单的C 语言程序举例6
1.4.2C 语言程序的结构10
1.5运行C 程序的步骤与方法12
1.6程序设计的任务14
1-5 #include 《stdio.h》
第一章 程序设计和C 语言 【第15页】
1-5
#include 《stdio.h》
int main ( )
{ printf (“**************************\n\n“);
printf(“ V ery Good!\n\n“);
printf (“**************************\n“);
return 0;
}
1-6
#include 《stdio.h》
int main()
{int a,b,c,max;
printf(“please input a,b,c:\n“);
scanf(“%d,%d,%d“,&a,&b,&c);
max=a;
if (max《b)
max=b;
if (max《c)
max=c;
printf(“The largest number is %d\n“,max);
return 0;
C程序设计谭浩强版本的第四版和第三版有什么区别
一、指代不同
1、C程序设计谭浩强版本的第四版:是2010年清华大学出版社出版的图书,作者是谭浩强。
2、C程序设计谭浩强版本的第三版:被普遍认为是学习C语言的好教材,并被全国大多数高校选用。
二、特点不同
1、C程序设计谭浩强版本的第四版:内容先进,体系合理,概念清晰,讲解详尽,降低台阶,分散难点,例题丰富,深入浅出,文字流畅,通俗易懂,是初学者学习C程序设计的理想教材,可作为高等学校各专业的正式教材。
2、C程序设计谭浩强版本的第三版:累计发行了700多万册,创同类书的全国最高记录,是学习C语言的主流用书。
三、影响不同
1、C程序设计谭浩强版本的第四版:该书被大多数高校用作C语言学习的教材,更正了第三版中的不足。
2、C程序设计谭浩强版本的第三版:曾荣获原电子工业部优秀教材一等奖、高校出版社优秀畅销书特等奖、全国高等院校计算机基础教育研究会优秀教材一等奖。
参考资料来源:百度百科-C程序设计(第三版)
参考资料来源:百度百科-C程序设计(第四版)
C程序设计谭浩强第四版终极程序
#include “math.h“
#include “stdio.h“
#include “REG52.H“
float max=0,sum=0; //计算失真度时所需要的全局变量
struct compx
{
float real;
float imag;
} ;
/*****************************************************************/
//函数名称: struct compx EE(struct compx b1,struct compx b2)
//返回值:旋转因子 即:x(n)W-N-kn(N为下标,kn为上标)
//功能: 生成旋转因子
//参数1:struct compx b1 即:x(n)
//参数2:struct compx b2 即: W-N-kn
/*****************************************************************/
struct compx EE(struct compx b1,struct compx b2) //旋转因子
{
struct compx b3;
b3.real=b1.real*b2.real-b1.imag*b2.imag;
b3.imag=b1.real*b2.imag+b1.imag*b2.real;
return(b3);
}
/*****************************************************************/
//函数名称: void FFT(struct compx *xin,int N)
//返回值:无
//功能: 实现FFT变换
//参数1:struct compx *xin 即:需要FFT变换的数组,类型为compx,对
// 于ADC采集后的数组其实部为AD值;虚部为0
//参数2:N 即: 转换的点数
/*****************************************************************/
void FFT(struct compx *xin,int N) //*xin为需要FFT变换的数组,N为转换的点数
{
int f,m,LH,nm,i,k,j,L;
double p , ps ;
long int le,B,ip;
float pi;
struct compx w,t;
LH=N》》1;
f=N;
for(m=1;(f=f》》1)!=1;m++){;}
nm=N-2;
j=N》》1;
for(i=1;i《=nm;i++) // 变址运算
{
if(i《j){t=xin[j];xin[j]=xin[i];xin[i]=t;}
k=LH;
while(j》=k){j=j-k;k=k/2;}
j=j+k;
}
for(L=1;L《=m;L++) //实现蝶形运算
{
le=(long int)pow(2,L);
B=le》》1;
pi=3.14159;
for(j=0;j《=B-1;j++)
{
p=pow(2,m-L)*j;
ps=2*pi/N*p;
w.real=cos(ps); //生成Wnk
w.imag=-sin(ps);
for(i=j;i《=N-1;i=i+le)
{
ip=i+B;
t=EE(xin[ip],w);
xin[ip].real=xin[i].real-t.real;
xin[ip].imag=xin[i].imag-t.imag;
xin[i].real=xin[i].real+t.real;
xin[i].imag=xin[i].imag+t.imag;
}
}
}
}
/*****************************************************************/
//函数名称:float THDcount(unsigned int *result)
//返回值:失真度值
//功能:求出失真度
//参数1:unsigned int *result 即:需求失真度数组地址
/*****************************************************************/
float THDcount(unsigned int *result)
{
unsigned int i=0,n=2,m,t=0;
float THD=0;
max=result;
for(i=2;i《256;i++)
{
if(result[i]》max)
{
max=result[i];
t=i;
}
}
m=t*n;
while(m《256)
{
sum=result[m]*result[m]+sum;
n++;
m=t*n;
}
sum=sum/(max*max);
THD=100*sqrt(sum);
return THD;
}
/*****************************************************************/
//函数名称:void main()
//返回值:无
//功能: 测试{2,3,3,2} 理论FFT转换后的值{10,-1-j,0,-1+j}
//参数: 无
//在Targe中设置Memory Mode为:Large:Variables in XDATA否则无法编译
/*****************************************************************/
void main()
{
struct compx aa;
aa.real=2;aa.imag=0;
aa.real=3;aa.imag=0;
aa.real=3;aa.imag=0;
aa.real=2;aa.imag=0;
FFT(aa,4);
while(1);
}

更多文章:
repercussions(都是余波,repercussions和aftermath有什么区别啊)
2026年10月11日 09:00
dropdownlist 绑定(DropDownList 绑定所有项 并 显示指定项)
2026年10月11日 08:50
易语言网页api接口怎么调用(易语言,怎么读取网页json的api)
2026年10月11日 08:00
majority of(the majority of 和 a majority of的区别以及用法例句)
2026年10月11日 07:40
another time(another time和other time的区别)
2026年10月11日 05:00




