Advice needed number prog.

I've changed it to what you see below. It's still not working..

help
: (
Thanks

#include <iostream>

using namespace std;

// Arrays & Functions Declaration //

float numbers[10];
// This Array will read in the numbers //

float sum=0;
// This will take in the total amount //

float average;
// Computes the average of total numbers //

int k=0;
// Takes in the users input

void readMoreNumbers (char &goOn);
// Checks to see if more numbers are to be entered //


// ******************************************************************** //

int main (int argc, char * const argv[])


{

// variable Definitions //

char proceed; // Quits? coded y/n //

// Needed to Initialize variable PROCEED, so while statment begins //

cout << " Hi I will take 10 numbers you enter and provide you with an average.";
cout << " Do you want to START ? (y/n) " ;
cin >> proceed;
cout << endl;


while ( proceed != 'n')
{
cout << " Enter a Number ";
cin >> numbers [k];
}
if (k =0; k <10; k =k++ )
{
sum = sum + numbers[k]<< endl << + (k + 1);

}

average = sum/10;
// calculates the average //

{
cout << " Number amount " << (k+1) << " is " << numbers[k];
// Prints out the numbers entered //
}
cout << " Tha average is " << average;
// Prints out the average //

return 0;
}
in next post please input your code yourcode
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include"stdafx.h"
#include <iostream>

using namespace std;

// Arrays & Functions Declaration //

float numbers[10];
// This Array will read in the numbers //

float sum=0;
// This will take in the total amount //

float average;
// Computes the average of total numbers //

int k=0;
// Takes in the users input

void readMoreNumbers (char &goOn);
// Checks to see if more numbers are to be entered //


// ******************************************************************** //

int main (int argc, char * const argv[])


{

// variable Definitions //

char proceed; // Quits? coded y/n //

// Needed to Initialize variable PROCEED, so while statment begins //

cout << " Hi I will take 10 numbers you enter and provide you with an average.";
cout << " Do you want to START ? (y/n) " ;
cin >> proceed;
cout << endl;


while ( proceed != 'n')
{
cout << " Enter a Number ";
cin >> numbers [k++];
if(k>=10) break;//end of while loop
}
 for(k =0; k <10; k =k++ )//for instead of if
{
sum = sum + numbers[k];//<< endl << + (k + 1);//

}

average = sum/10;
// calculates the average //

{
cout << " Number amount " << (k) << " is " << numbers[k];
// Prints out the numbers entered //
}
cout << " Tha average is " << average;
// Prints out the average //
system("pause");

return 0;
}

i try running.it is ok.
good luck

1
2
3
4
5
6
7
8
9
10
11
12
13
Hi I will take 10 numbers you enter and provide you with an average.Do you want to START ? (y/n)y
Enter a Number 5 
Enter a Number 6
Enter a Number 7
Enter a Number 8
Enter a Number 9
Enter a Number 0
Enter a Number 3
Enter a Number 4
Enter a Number 1
Enter a Number 2

Number amount 10 is 45   Tha average is 4.5.Press any key to continue.....
Last edited on
Your the best thanks.. I'm gonna study this.

Topic archived. No new replies allowed.