Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h" //No Flipping Clue
- #include <iostream> //Needed For "cout"
- #include <iomanip> //Needed To Round Decimal Points
- #include <math.h> //Needed For "sqrt()" And "pow()"
- using namespace std;
- int _tmain(int argc, _TCHAR* argv[])
- {
- //Used To Round The Decimal Points 2 Places
- cout << setiosflags(ios::fixed|ios::showpoint);
- cout << setprecision(1);
- //Declaring
- double Numbers[] = {65, 49, 74, 59, 48}; //Work On Making This A User Input
- double Mean = 0, Items = 0, Sum = 0, Deviation = 0;
- int Counter;
- //Finds The Mean Of The Set Of Numbers
- for (Counter = 0; Counter < (sizeof(Numbers) / sizeof(double)); Counter++)
- {
- for (Counter = 0; Counter < sizeof(Numbers) / sizeof(double); Counter++)
- {
- Sum += Numbers[Counter]; //Adds All Numbers In Array Together
- }
- Items = sizeof(Numbers) / sizeof(double); //Gets The Number Of Items In The Array
- Mean = Sum / Items; //Finds The Mean
- }
- //Finds The Standard Deviation
- for (Counter = 0; Counter < sizeof(Numbers) / sizeof(double); Counter++)
- {
- Deviation += pow((Numbers[Counter] - Mean), 2) / Items; //Does Math Things...
- }
- Deviation = sqrt(Deviation); //Square Roots The Final Product
- cout << "Deviation = " << Deviation << endl; //Print Out The Standard Deviation
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement