# Thread: Mean, Median, and Mode .....code

1. ## Mean, Median, and Mode .....code

I've written a simple code that finds the mean, median, and mode of a set of data. I have a compiler (MSVC++.net), but I can't install it. So I've written codes in notepad and will compile them later. If anyone finds any problems with this code, please tell me. And if you can help me, here's the problem with MSVC++.net:
I'll insert CD1 and hit "install prerequisites", and it says the system must reboot, so it does so, and then I have to start over again (it doesn't restart Setup from where it left off.) What should I do?

This is the code:

#include <iostream>
using namespace std;

int main()
{
int exit=0;
while (exit !=1)
{
int set[200];
int a;
int b[200];
cout<<"How many numbers are in the set?"<<endl;
cin>>a;
cout<<"enter your set, one number at a time:"<<endl;
for (int c=0, c<a, c++)
{
cin>>b[c];
}
for (c=0, c<a, c++) //bubble sort
{
if (b[c]>b[c+1])
{
int temp;
temp = b[c];
b[c]=b[c+1];
b[c+1]=temp;
temp=0;
}
}
for (c=0, c<a, c++)
{
for (int e=0, e<c, e++)
{
int sum = b[c]+b[e];
}
}
int average = sum/a; //finds average of data
int z = a-1;
double median = b[z/2];
if (a%2==0)
{
temp =a/2;
z=temp+1;
int y =tmep-1;
int x = z + y;
median = x/2;
x=0;
y=0;
z=0;
temp=0;
} //median

int max = b[a];

for (c=0, c<max, c++)
{
for (e=0, e<a, e++)
{
if (c==b[e])
{
int frequency++;
}
int num = b[e];
int frequency2[a][1];
frequency2[e][0]=frequency;
frequency2[e][1]=b[e];
}
}
for (c=0,c<a, c++)
{
if (frequency[e][0]>frequency[e+1][0])
{
temp=frequency[e][0];
frequency[e][0]=frequency[e+1][0];
frequency[e+1][0]=temp;
temp=0;
temp=frequency[e][1];
frequency[e][1]=frequency[e+1][1];
frequency[e+1][1]=temp;
}
}
int mode = frequency[a][1];
cout>>"The Mean is:"<<average<</n"The median is:"<<median<</n<<The Mode is:"<<mode;
cout>>/n"Click one to exit, or any number to start over."<<endl;
cin>>exit;
}
return 0;
}

2. >>I'll insert CD1 and hit "install prerequisites",
What happens if you don't install them?

And do you have admin rights on that computer?

3. Also, the [code] tags are your friend