Assuming the image is an RGB image, sum the red, green and blue components of the pixels separately then divide each by the number of pixels. E.g., given two pixels RGB(a, b, c) and RGB(x, y, z) the mean is RGB ((a+x)/2, (b+y)/2, (c+z)/2).
#include
#include
#include
#include
using namespace std;
int input_number( unsigned index )
{
string input = "", nth = "";
int number = 0;
switch(index%10)
{
case(1): nth="st"; break;
case(2): nth="nd"; break;
case(3): nth="rd"; break;
default: nth="th";
}
while( true )
{
cout<<"Please enter the "< getline( cin, input ); stringstream ss( input ); if( ss >> number ) break; cout<<"Invalid number, please try again"< } return( number ); } int main() { unsigned index=0, max_numbers=50; int mean=0, sd=0; __int64 sum=0; vector cout<<"Enter "< while( index number.push_back( input_number( ++index )); cout<<"\nSet of numbers: "; for(index=0; index { sum += number[index]; cout< } cout<<'\n'< mean = sum / number.size(); for(index=0; index sd += (number[index]-mean) * (number[index]-mean); sd /= number.size(); sd = (int) sqrt((double) sd); cout<<"Sum: "< cout<<"Mean: "< cout<<"SD: "< cout< } Example Output Enter 50 numbers Please enter the 1st number: 42 Please enter the 2nd number: 54 Please enter the 3rd number: 62 Please enter the 4th number: 89 Please enter the 5th number: 87 Please enter the 6th number: 95 Please enter the 7th number: 12 Please enter the 8th number: 15 Please enter the 9th number: 65 Please enter the 10th number: 984 Please enter the 11st number: 123 Please enter the 12nd number: 84 Please enter the 13rd number: 6 Please enter the 14th number: 65 Please enter the 15th number: 54651 Please enter the 16th number: 65 Please enter the 17th number: 9 Please enter the 18th number: 9 Please enter the 19th number: 9898 Please enter the 20th number: 454 Please enter the 21st number: 21 Please enter the 22nd number: 56 Please enter the 23rd number: 5665 Please enter the 24th number: 45 Please enter the 25th number: 7 Please enter the 26th number: 54 Please enter the 27th number: 25 Please enter the 28th number: 7 Please enter the 29th number: 6782 Please enter the 30th number: 981 Please enter the 31st number: 6514 Please enter the 32nd number: 213654 Please enter the 33rd number: 45 Please enter the 34th number: 984 Please enter the 35th number: 564 Please enter the 36th number: 1 Please enter the 37th number: 6 Please enter the 38th number: 4654 Please enter the 39th number: 49 Please enter the 40th number: 61 Please enter the 41st number: 321 Please enter the 42nd number: 951 Please enter the 43rd number: 324 Please enter the 44th number: 8 Please enter the 45th number: 98 Please enter the 46th number: 951 Please enter the 47th number: 65 Please enter the 48th number: 65 Please enter the 49th number: 54 Please enter the 50th number: 6 Set of numbers: 42 54 62 89 87 95 12 15 65 984 123 84 6 65 54651 65 9 9 9898 454 21 56 5665 45 7 54 25 7 6782 981 6514 213654 45 984 564 1 6 4654 49 61 321 951 324 8 98 951 65 65 54 6 Sum: 309887 Mean: 6197 SD: 8955
to calculate standard deviation using pointers
it is a program that computes whit aerodynamic serious consequences with full winded service that control a component
90
ghfj
The std::cout and std::cin streams are peculiar to the C++ standard library. They are not available in the C standard library, but are analogous to stdin and stdout which is in the C standard library.
1. Calculate the mean average of the N numbers. Suppose it is stored in the variable D. 2. Now calculate the differences between each number with D and square the value. As there are N numbers so store this difference in an array. Example arr[0] = (num0 - D)^2; arr[1] = (num1 - D)^2; arr[N-1] = (numN - D)^2; 3. Now sum array value and divide by N, suppose the value is stored in F. Now square root F. It is the standard deviation of your N number. I hope you can write the code by yourself or follow the part: suppose you will store the N numbers in an array num. Now: int num[N+2], D = 0; //or declare the num array as float or double if there are any precision value for(int i = 0; i < N; i++) { D += num[i]; } D /= N; int arr[N+2]; for(int i = 0; i < N; i++) { arr[i] = (num[i] - D)^2; //square the difference. } int F = 0; //if precision value is accepted then declare F as float or double not int. for(int i = 0; i < N; i++) { F += arr[i]; } F /= N; F = sqrt(F); //use #include <cmath> in your header file list so that you can use sqrt() function or simply use #include <bits/stdc++.h> cout<<F<<endl; - Thanks
A worked out example is shown in the related link. There are a number of calculators that do this automatically. Also, the Excel program (and most other spreadsheet programs) include a standard deviation function. In Excel, it is +stdev(a1:a10) for a list of numbers from a1 to a10.
it is a program that computes whit aerodynamic serious consequences with full winded service that control a component
90
ghfj
Program in CHere is a program in C to calculate mean variance and standard deviation: #include#includevoid main(){float a[50],sum=0,vsum=0,mean,variance,sd;int n,i;printf("Enter the no of valus");scanf("%d",&n);printf("Enter the no of valus");for(i=0;i
The verb for computer is compute.Other verbs are computes, computing and computed."I am computing"."We have computed the program""I like to compute".
Write your program and if you are having a problem post it here with a description of the problem you are having. What you are asking is for someone to do your homework for you.
standard text code is important because it would enable any programmer or programme to use the same combination of numbers to represent the same individual pieces of data.
That really depends on what sort of program you are trying to build, what do you want the program to do?
#include<stdio.h> #include<conio.h> void main() { int i=1,sum=0; clrscr(); while(i<10000) { if((i%3==0)(i%5==0)(i%7==0)) { sum=sum+i; } i++; } printf("\nThe sum is%d",sum); getch(); }
A program which is used to count the number of numbers in an array using a 8085 microprocessor is known as a assembly language program.
AFOSH Standard 48-9