I'm learning about arrays in my C++ class and am having some trouble with them. We have an assignment that states:

Write a program that will:

(1) Ask the user how many times a simulated pair of dice should be thrown.

(2) Ask whether the user wants to see each individual result. (With a large number of throws, the user may only want to see the final results.)

(3) "Throw" the dice the number of times requested, keeping track of the number of times each possible sum occurs.

(4) Display the final totals using a bar graph. A bar should be shown for the number of occurrences of each possible sum, from 2 to 12. Use a horizontal row of asterisks (or an appropriate graphics character) for each bar.

Your program should include a RollDie function. This function should pick random integer from 1 to 6 and return the result.

Use an array to keep track of how many times each sum occurred.

This is what I have:

```
#include <iostream>
#include <fstream>
#include <conio.h>
using namespace std;
int main()
{
int howmany, result1, result2, sum;
char response;
int total[13];
int RollDie(int result);
cout << "How many times would you like a pair of dice to be thrown? ";
cin >> howmany;
cout << "Would you like to see each individual result? (y or n) ";
cin >> response;
for (howmany=0;howmany<10;howmany++)
{
cout<<RollDie(result1);
cout<<RollDie(result2);
}
for (sum=0;sum<13;sum++)
{
sum = result1 + result2;
if (sum = 2)
total[0] = 2;
if (sum = 3)
total[1] = 3;
if (sum = 4)
total[2] = 4;
if (sum = 5)
total[3] = 5;
if (sum = 6)
total[4] = 6;
if (sum = 7)
total[5] = 7;
if (sum = 8)
total[6] = 8;
if (sum = 9)
total[7] = 9;
if (sum = 10)
total[8] = 10;
if (sum = 11)
total[9] = 11;
if (sum = 12)
total[10] = 12;
}
getch();
return 0;
}
int RollDie(int result)
{
int result;
result = rand()%6;
return(result);
}
```

I'm sure there's a way to eliminate the if statements, but I'm drawing a blank. And I'm sure there's other mistakes within the program as well :( any help would be appreciated.