Hello,

Currently, i was assigned to create an array, which i have no idea what array is.

The problem is this....

2.Write a function to read in numbers and put them into the array. The function should continue to read in numbers until either: the user types a negative number, or 100 numbers (hint: MAXSIZE) have been read. The function should also return the number of elements in the array. Write comments before the function that describe what the function does, what it needs passed to it, what it sends back to the function call, and how it accomplishes its task.

3.Then write a second function that will accept an array and print out the contents of the array. This function should accept an array and the number of elements that are to be printed. Before writing the code for this function, write the comments.

#include <iostream>
using namespace std;
int Function1(double []);
void PrintArray(const double [], int);

const int MAXSIZE =100;

int main()
{
	double array1[100];
	int count;

	count = Function1(array1);
	cout<<"There were "<<count<<" numbers entered into the array."<<endl;

	//function call to for the array


	return 0;
}

//Write the function here to read in numbers into the array. 
//add comments describing what this function does, 
int Function1(double myarray[])
{

}

//Write the new function here along with comments
//add comments describing what this function does, what is passed to it, what it sends back, etc.
void PrintArray(const double a1[], int size)
{

}

Recommended Answers

All 4 Replies

Currently, i was assigned to create an array, which i have no idea what array is.

Oh come on! Then I (along with several others) would suggest you to read your C Programming book before diving into such problems

commented: Thank you for beating me to this thread! +11

Can anyone help me on this array problem? thanks

Can anyone help me on this array problem? thanks

1. start your own thread, don't hijack.
2. You're not going to get any help unless you try first, read the rules and announcements. If you don't have the link, see my previous post.
3. We can't help you anyway, we don't know what your problem is.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.