Need help with homework!!

I have an assignment from my CSCI class where I am tottally out of my element. If I could have some help with creating a program, it would be much appreciated. ANY kind of help would be helpful.
Last edited on
Shouldn't you tell everthing that has been discussed in the class so that we don't accidentally say something disallowed?

Did you have 'main'?
Did you have hello world?
Did you have user input?
Did you have loop structures?

Based on what you have had, write as much code as you can. When you have that, we can look at specific problems.
Sorry, but no user input, not sure what you mean by 'hello world', no user input (i think), and we have to create a loop?

I'll try starting the program the best I can, but this isn't my best of subjects due to many reasons, so hopefully you can guide me in the right direction.



#include <iostream>
using namespace std;

int main()
{
int = 1
int = max
int = min
int = sum
}
while ..

Not too sure what I could do after declaring the variables. I'm sure I haven't even declared the variables correctly..
Last edited on
So, I wasn't really sure what was allowed and what wasn't, but given from your description,
I made this as simple as possible.

It doesn't check for user input errors.

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
#include<iostream>

using namespace std;

int main(){
    int userNumbers[10],counter=1,sumTotal = 0,maxNum,minNum;

    cout << "You will be asked to input 10 numbers\n\n";
    cout << "Please enter your first number: ";
    cin >> userNumbers[0];

    while (counter < 10){
            cout << "Please enter your next number: ";
            cin >> userNumbers[counter];
            counter++;
    }
    //Loop that searches for min and max
    maxNum = userNumbers[0];
    minNum = userNumbers[0];

    for (int x = 0; x < 10; x++){

       if (userNumbers[x] > maxNum){
            maxNum = userNumbers[x];
        }

        if (userNumbers[x] < minNum){
            minNum = userNumbers[x];
        }

        sumTotal +=userNumbers[x];
    }





    cout << "\n\nThe Max Number is: " << maxNum;
    cout << "\nThe Min Number is: " << minNum;
    cout << "\nThe Sum is: " << sumTotal;
    cout << "\nThe Average is: "<<sumTotal/10;

return 0;
}


good luck and if you still want to learn this language, this site, has a really good tutorial

http://cplusplus.com/doc/tutorial/
Topic archived. No new replies allowed.