1. ## Arrays

First, I just want to state that I am as new to C++ as one can be. I'm an Engineering student at PSU, and I am currently enrolled in C++ as the one, and only, computer programming class that I need. So far, I've done well with writing programs, but now I am stumped. We have to write a program that will have 2 functions. 1.) Use an array to let the user enter in 12 numbers. 2.) Have a function to output what the maximum number they entered was. I'm stumped, and our book isn't helping. Any input, advice would be appreciated. Bascially, I just need to know how to let the user enter 12 numbers to be put into an array!! Thanks,
Joai

2. First, I just want to state that we do not do homework. Second, if the book is not helping at least try to write something and post it here. Then some of us might help you.

However my policy is that if you are going to school then you have far more resources than I for answering your question. Use them. I do not help with homework.

3. Code:
```const int MAX=12;
int printArray (int [])

int main ()
{
int numArray[MAX];

cout << "Please enter 12 numbers";

for (int i=0; i<MAX; i++)
cin >> numArray[i];

printArray(numArray);
return 0;
}

//-------------------------------------------

void printArray (int numArray[])
{
cout << "The numbers you entered were :   "

for (int i=0; i<MAX; i++)
cout << numArray[i] << endl;

}```
main contains the for loop to gather the numbers. it then calls the printArray function, which in turn prints the results.

cheers

4. Geez. Just do it for them. Yep they learn good that way.

5. sorry

wasnt thinking when I answered....busy stressing out about my finals

6. Sorry, I wasn't asking for you to actually *do* it for me, but just a general way of doing it. I actually did figure it out .. after lots of reading online. I thought this message board was for help, but I guess it isn't. Sorry.

7. I thought this message board was for help, but I guess it isn't.
I'm so tired of people like you saying this. Read the Announcements. We don't do everything for you. The word "help" means "to give assistance". That is to say, we aid you along your path.

Of course, there are people who do not help but instead do it for you, which is actually what most people really want when they request "help".

"Help me" is in effect this:
I'm working on Foo, and I've run into a problem. I have the following code...
Code:
```int main(  )
{
int x;

x = x + 5;
cout << x;

return 0;
}```
And it is not giving me the output of 5 like it should. It instead gives me some wierd number. Does anyone know why?
THAT is a decent request for help. Here, I have shown my attempt at the problem. I have describe the problem. I have described what it should be doing. I have asked for help with discovering why it doesn't do what it should.

THAT is how you ask for "help".

But if you'd read the Announcements like you should have, you'd know this.

Quzah.

Popular pages Recent additions