谁能帮我解下这五个图片里的C语言题目啊。实在是做不出来了。求解。。。。求解

是用Turbo C的。

以下有四道,还有一道:cprog301.c我认为有问题,根本没用函数fun ;

#######################################

(cprog352.c):

void fun(char *s,char t[])

{

int i=0,j=0 ;

for(i=0;i<strlen(s);i++){

if((i%2!=0)&&(*(s+i)%2!=0)){

*(t+j) = *(s+i) ;

j++ ;

}

}

*(t+j) = '\0' ;

}

void main()

{

char s[100],t[100] ;

printf("\nplease enter string s:") ;

scanf("%s",s) ;

fun(s,t) ;

printf("\nThe result is:%s\n",t) ;

    getch() ;

}


################################

(cprog431.c):

#include<stdio.h>

#include<conio.h>

#include<math.h>

double fun(double x,double y)

{

double result = 0.0 ;

result = (7.7*x + 6.9*y)/(2.3*y + 1.3*x) ;

return result ;

}

void main()

{

printf("fun(1.1,0.2) = %6.3lf\n",fun(1.1,0.2)) ;

    getch() ;

}


###############################

#include<stdio.h>

#include<conio.h>

int fun(long a[])

{

int i=0,n=0 ;

long *p ;

p = a ;

for(i=1;i<=999;i++){

if((i*i%1000 == i)||(i*i%100 == i)||(i*i%10 

== i)||(i*i == i)){

*(p+n) = i ;

n++ ;

}

}

return n;

}

void main()

{

int i,n ;

long a[20] ;

n = fun(a) ;

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

printf("%ld ",a[i]) ;

printf("\n") ;

printf("n=%d\n",n) ;

    getch() ;

}


#################################

#include<stdio.h>

#include<conio.h>

#include<math.h>

double fun(double x)

{

return (sin(2*x) + 3*tan(x*x)) / fabs(log(x) + sqrt

(1+cos(x))) ;

}

void main()

{

double x ;

printf("please input x:") ;

scanf("%lf",&x) ;

printf("\nfun(%6.3lf) = %6.3lf\n",x,fun(x)) ;

    getch() ;

}

追问

我要用Turbo c的,你的是用什么的啊。我用tc的输入后不会出来结果,这是为什么

追答

我用的VS2010,这是用C语言写的,TC上编译运行百分之百没问题。(现在我安装的是64位机,TC用不了,不然给你看看)。个人觉得你可能TC的使用方法不对。1.运行前要保存,2.按ctrl+F9运行,3.按Alt+F5查看结果。再按Alt+F5回到编辑状态。具体操作可以看下面的链接:http://www.bobd.cn/itschool/system/win98dos/200612/its

参考资料:http://www.bobd.cn/itschool/system/win98dos/200612/its

温馨提示:答案为网友推荐,仅供参考
相似回答
大家正在搜