VB编写fun函数,函数功能为计算n门课程的平均值
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/11 08:24:33
intfun(char*s){char*p1,*p2;p1=s;p2=s;while(*p2++);p2--;while(p1p2)return1;elsereturn0;}
#include#includeintmain(){\x09inti;\x09charss[20];\x09printf("请输入字符串:\n");\x09scanf("%s",ss);\x09for
PrivateSubfun()ifimod2=0thenforx=itoastep2s=s*xnextxelseforx=(i+1)toastep2thens=s*xnextxendif试试看行不行吧
doublefun(doublex){{doublei,t=1.0,m=1.0,s=1;for(i=1;fabs(m/t)>=0.000001;i++){s=s+m/t;m*=(0.5+1-i)*x;
#include#includeintfun(intx){intr=1,d,c;while(1){d=x%10;r=r*d;x=(x-d)/10;if(x==0)break;}returnr;}mai
int是整型long是长整型long的空间比int大int只能定义数-32767到32767大于这个范围用long定义按标准规定int的长度是16位或者32位,long是32位.大部分C++编译器中i
#includeintf(intn){inti,k;for(i=2,k=0;i
PrivateFunctionSumA(ByValaAsInteger)AsLongDimiAsInteger,NAsIntegerFori=500To600IfiModa=0ThenN=N+iNex
#include#includeintfun(intn){intsum=0,i;for(i=1;i
上面的错了应该是intfun(){inti,sum=1;for(i=1;i
#include#includevoidswap(intc[],intlen){inti=0;inttmp;for(;i{tmp=c[i];c[i]=c[len];c[len]=tmp;}}intmu
1,JAVA编的,n可以任意赋值publicdoublefun(intn){doublesum=0;for(inti=1;i1;n--){inti=max(a,n);inttemp=a[i];a[i]
Private Sub Command1_Click() Dim x As Single, y
Functionsum(n)AsDoublesum=0Fori=1TonIfiMod2=0Thensum=sum+i*iNextEndFunction
Functions(ByValaAsInteger,ByValbAsInteger)AsIntegerDimiAsIntegerFori=1To1000IfiModa=0AndiModb=0Thens
#include#includedoublefun(intn)//计算1!+2!+3!+.+n!,并赋值给fun{inti;doubles=0,t=1;for(i=1;i
#include"stdio.h"#include"math.h"doublefun(double*a,intlen){inti;doubles;for(i=0,s=0;i
longfun(longx){for(inti=0;i
#include#includefloatfun(inta,intb){floatc;c=sqrt(a)+sqrt(b);returnc;}intmain(){inta=12,b=20;floatc;
这个题目应当有原来的程序,让人填空.如果自己写程序,很简单:#include#includevoidfun(int*x,int*y){intz;z=*x;*x=*y;*y=z;}main(){inta