1. ## Programming question

Ok guys, I could use a little programming help. I have two programming problems that I have to figure out, and I've been pounding my brain for the last two weeks trying to solve them. I'm not a programmer, basic reason why. If anyone can help me on this, I can't do anything for ya except give my thanks. Here's one program:

I. Write a program that will input non-negative integer and call a function DWARF to determine if the integer is DWARF or not.

Output Specifications

Print
The factors of N:
The sum of its factors are :
Half of N is
N is DWARF

Sample Input

Input N? 6

Sample Output
Factors are 1,2,3
The sum of its factors are 1+2+3=6
Half of the number is 3
6 is DWARF

Sample Input
Input N ? 9

Sample Output
Factors are 1,3
The sum of its factors are 1+3=4
Half of number is 4.5
9 is DWARF

The other is this
II. ARRAY - An instructor gave a multiple choice test, which consists of 5 questions, each of which is answered by a choice of one of the #s 1 - 5. The program should grade the test. If the student choice is 1, give 1 point. If the choice is 2, give 2 points, and so on. Otherwise no point is given. The programe should compute the average score of the student on the given test.

Input Specifications
Write a program that will accept student name and the set of their test answer.

Output Specifications
Print the name of the student, his/her total score, and the set of their test answer.

Sample Input
Enter Student Name: Mae

Sample Output
Mae, your total score is 19 and your average score is 3.8.

I hope you guys can understand all this. I'm not that good in programing, but if anyone can give me something that I can put into turbo C++ to make these work, I will owe you lunch if I could give it to ya. Thanks

Kev     3. I did. It didn't work. 4. If you are not a programmer then why are you programming?
I think you signed up for the wrong classes  5. Long story, but basically the school I'm at has me in what they call non-traditional studies. Basically, I'm on my own. I don't go to class or nothing. I can contact the professor if I need help. The problem is that the professor they gave me is always busy. So, I'm pretty much own my own. I tried all the online tutorials, but they only teach so much. I'm really in a bind here. And if you're wondering why I don't transfer, it's because the gov. is paying for the class, and I have to pass or else. Like I said, long story. Once I finish the semester, I can get back into traditional classes. I just have to finish this semester. 6. > I did. It didn't work.
So post what you did achieve, then we can perhaps help you to fix it. 7. Ok, I'll try to post it in about another 24 hours. I'm in the Phils, so I'm about to sleep. I'm still working on it. I'll send what I have tommorow, k? Thanks. By the way, im not asking anyone to do the work for me, just help me understand it better. Thanks again!  8. I hear McDonalds is hiring. 9. I gotta say that sucks, but considering its a free course.. You could have read about.com, cprogramming.com, cpluscplus.com, and etc. tutorials and have gotten how to do this. If you need that much explanation, and considering its a semester, I recommend getting 2 C++ books, it WILL be necessary in your situation. Accelerated C++ and C++ Primer Plus are my recommendations.

The factors of N:
The sum of its factors are :
Half of N is
N is DWARF
- Use cin >> to put N into a variable.
- Make an array arrayofFactors to hold the arrays, allocated at say 15 values of int.

- To calculate the factors you could use a for loop that runs while some variable is > 1, and < N / 2.
Code:
`e.g. for(int i = 1; i <= N / 2 && i > 0; i++)`
- Then inside the for loop you use the modulus operator % that checks if N % i is equal to 0.
Code:
```e.g. if(N % i == 0) {
arrayofFactors[j] = i;
j++; }```
- The j there is the number of factors found so far, and obviously arrayofFactors is the ones found.
- Simply use a for loop and print the array of factors.

- Simply use a for loop to add the array of factors together.
e.g. factorSum += arrayofFactors[i];

- To calculate half of N simply: variable / 2, and cout << that.
N is DWARF? just cout << the variable.

Some of that syntax might be incorrect , how about you try posting ANYTHING you can figure out for yourself, and dont just try the first part and if you cant do it give up, skip to the next part, and post everything and describe what you cannot figure out how to do. Popular pages Recent additions 