帮忙把下面个c函数转成c#的
const int num=100
float neiji(float [num]b, float [num]c)
{
int p;
float nj = 0;
for (p = 1; p < num; p++) nj += c[p] * b[p];
return nj;
}
C# code:
const int num=100
public float neiji(float[] b, float[] c)
{
float nj = 0;
for (int p = 1; p < b.Length; p++) nj += c[p] * b[p];
return nj;
}
呃,这样的话b.length是不是等于100哟?
const int num=100;
private float neiji( float []b, float []c)
{
int p;
float nj = 0;
for (p = 1; p < num; p++)
&nbs
相关问答:
char data[255]={0},user[15],password[32];
if((fp=fopen("QQ.ini","wb+"))==NULL)
{
printf("无法创建QQ.ini文件\n");
system("pause");
exit(0); ......
开始学OS,按练习要求写的代码在gcc下无法编译:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
void SIGFPEhandler2(int s ......
/*-----------c.h--------------*/
#ifndef _C_H_
#define _C_H_
extern "C" int add(int x, int y);
#endif
/*-----------c.c--------------*/
int add(int x, int y){
return ......
给一个字符串、例如 “ababc”要求返回“ab”. 因为“ab”连续重复出现且最长。 用C/C++语言写一函数完成该算法,给出复杂度
这个题我不会
C/C++ code:
#include <iostream>
#include <s ......