Project troubles.

Hey everyone, first off i wanted to say its nice to find a good information forums where everyone is welcome.

Down to business. My project i am working on needs help and i am stuck. i have included all that i know. what i am looking for is guidance and direction. Possibly throw in a small note or two as to WHAT goes where, not the code itself. I understand that asking for the code itself is asking for answers. Please help all that you can. Also, if you see any noticable mistakes feel free to help me out. The project is supposed to load a series of random integers ( negative and 0 accepted into an array, and from there calculate and display both the array and average.
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
68
69
70
71
72
73
74
75
76
77
78
79
80
/************************************************************
*                                                          					     *
*          Project file : XXXXXXXXXXXXXXXX.docx   			     *
*                                                           					     *
*          Reads a series of positive and negative integers		     *
*          from the user and loads the values into an array    		     *
*           								     *
*                                                         					     *
*          Output will be an array containing random values 		     *
*                                                                                                                                  *
*       Author: XXXXXXXXXXXX                               			     *
*       Date Written: 4/29/2011                                  			     *
*                                                                                                                 	     *
*    Revisions: From XXX 6 May 2011                   			     *
*                                                           				                     *
************************************************************/

#include <iostream>

using namespace std ;

//Call of Functions
void inputmod (int values [], int &count)

/***************************************************************************
*                                                                        						       *
*  	inputmod                                                             					       *
*                                                                         						       *
*	a general utility routine for prompting a user to enter numbers      		       *
*	into an array.  The user indicates that all values have been        		       *
*	by entering an EOF (end of file) which is CTRL Z on an MS-DOS      		       *
*	operating system.  After the user enters CTRL Z the routine outputs      		       *
*	the data entered using outputmod                                     			       *
*                                                                          					                       *
*   	parameters                                                             				       *
*	values	an integer array which is filled and returned              			       *
*	count	a reference parameter that upon return contains                		       *
*		the number of values read                                     		 	       *
*                                                                          					 	       *
*   	Author:		XXXXX                                                        			       *
*   	Initial Release:	4/1/2007                                           				       *
*                                                                        						       *
*   	Revisions:                                                             					       *
*                                                                          						       *
***************************************************************************/

main() 

//Declare Variables
int count
float values
int array[100]		 //Declare array

{			//Input function
	count = 0;
	do
		cout << endl <<"Enter value " << count << ;
			endl << "CTRL Z to stop" << endl << ">> " ;
	while (cin >> values [count++]);
	count--;
	
}

{ 			//Average Function float return value

int sum ;
int average = 0 ;
int array[100] = {1,2,3…100);
for (int i = 0; I < 10; ++i);
	sum+array[i];
average = sum/i;
return 0;
}

//Get User Data




Last edited on
closed account (1yvXoG1T)
First, you'll want to double-check your syntax. I'm noticing a few missing braces and semi-colons. Also, a while or do-while loop will just keep going until the condition is met.
You don't have any conditions in your while statement, you merely request input from the user and iterate the counter.

This isn't really required but it's just a note of cleanliness: I don't understand why you have your code sections broken up by braces. This just adjusts the scope of the code and makes it look rather messy.
the

while (cin >> values [count++]) ;

is meant to continue until user uses the ctrl z method to end the inputs and allow the program to compute the average and display the array

also, what lines require the brace removal and what lines need to add braces and semi-colons?
Last edited on
I also understand im going to need an output function. Where in the program would that be located? and are my functions in the correct placement?
Topic archived. No new replies allowed.