Vous essayez d'écrire un programme qui utilise une matrice pour calculer l'écart-type. Il continue à me donner une erreur:L'affectation de déviation standard C++ nécessite une erreur de correction de l'aide.
"LNK2019 unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" ([email protected]@YAHXZ) ConsoleApplication7777 C:\Users\Gregory\Desktop\ConsoleApplication7777\ConsoleApplication7777\MSVCRTD.lib(exe_main.obj) 1"
Voici mon code:
#include "stdafx.h"
#include<iostream>
#include<cmath>
using namespace std;
double standard_Deviation(double x[], int n);
//Main Function here
void Main()
{
//declare variables here
double x[100];
double sDeviation;
int i;
int n;
//input number values here
cout << "Enter n value";
cin >> n;
//input array values here
cout << "Enter values:" << endl;
for (i = 0; i < n; i++)
cin >> x[i];
//call standard deviation function
sDeviation = standard_Deviation(x, n);
//outputting standard deviation
cout << "Standard Deviation:" << sDeviation << endl;
//give it time to think
system("pause");
}
double standard_Deviation(double x[], int n)
{
double sd = 0;
double mean=0;
for (int i = 0; i<n; i++)
mean = mean + x[i];
mean = mean/n;
for (int i = 0; i<n; i++)
sd = sd + pow((x[i] - mean), 2);
sd = sd/n;
sd = sqrt(sd);
return sd;
return mean;
} //end of standard deviation
'main' est écrit avec le cas m plus bas et a retourner type 'int' – mathematician1975
changement' void main() '' pour principal int() ' – JackVanier