Number of Respondents Calculator in C++

Number of Respondents Calculator in C++

Version
Download 12
Total Views 0
Stock
File Size 1.39 KB
File Type zip
Create Date May 9, 2016
Last Updated May 9, 2016
Download

Number of Respondents Calculator in C++

Sample program in c++ that will compute the number of respondents using the sloven’s formula. To compute the number of respondents the user must enter the total population size.

Sloven’s formula:
n = N/(1+(Ne2))
where:
n = number of respondents
N = total population
e = margin of error , 0.05 in this case

Source code:

#include < iostream >

using namespace std;

int main()
{
    int totalpopulation;
    double respondents;
    cout << "Enter total number of population: " << endl;
    cin>> totalpopulation;

    respondents = (totalpopulation / (1 + (totalpopulation * 0.0025)));

    cout << "Number of respondents based on sloven formula: " << respondents << endl;
    return 0;
}

Comments

comments

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.