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.
/************************************************************
* *
* 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>
usingnamespace 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
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.