[問題] 'std' redeclared as different kind of symbol
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
C++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
出現[Error]'(double std(int, double*))'redeclared as different kind of symbol
不知道該如何解決
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
#include<iostream>
#include<cmath>
using namespace std;
double mean(int n,double data[])
{
double sum,average,b,sumb,s;
for(int i=0;i<n;i++)
{
sum+=data[i];
}
average=sum/n;
cout<<" 總平均為:" <<average<<endl;
return 0;
}
double std(int n,double data[])
{
double sum,average,b,sumb,s;
for(int q=0;q<n;q++)
{
b=pow(data[q],2);
sumb+=b;
}
s= sqrt((sumb/n-pow(average,2)));
cout<<" 標準差為:" <<s<<endl;
return 0;
}
int main (){
int n;
double data[1000];
cout<<"請問想輸入幾個數字?";
cin>>n;
for(int i=0;i<n;i++)
{
cout<<"請輸入第"<<i+1<<"個數字:";
cin>>data[i];
}
mean(n, &data[0]);
std(n, &data[0]);
return 0;
}
補充說明(Supplement):
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 120.126.36.171
→
12/12 23:22, , 1F
12/12 23:22, 1F
→
12/12 23:23, , 2F
12/12 23:23, 2F
→
12/12 23:24, , 3F
12/12 23:24, 3F
→
12/12 23:28, , 4F
12/12 23:28, 4F
→
12/12 23:28, , 5F
12/12 23:28, 5F
→
12/12 23:33, , 6F
12/12 23:33, 6F
→
12/13 23:45, , 7F
12/13 23:45, 7F