array programs

Need to write two programs and pretty lost. Been home sick for the past week due to eating seafood (stomach flu) missed lecture on arrays, and the book isn't much help. can someone maybe give me a crash course on arrays? I tried reading on them and seems like eveeryone uses different ways to explain it. I see "cout and cin" being used, my professor uses printf and scanf functions.
can someone help me write the code, or break down the code for me? please

Program 1: Write a program that simulates the roll of two dice. The program should call rand to roll first die, and should call rand again to roll the second die. The sum of two values should then be calculated. The sum should be between 2 and 12. Your program should roll the two dice 100 times. Use one dimensional array to tally the numbers of times each sum appears. Print the result in tabular format as shown below:

2 7
3 9
4 10
. .

Note: Use the following statement before you call rand function;

srand( time( NULL ) ); // #include <time.h>, #include<stdlib.h>

Program 2: Arrange an array in descending order using a function. Follow these steps:

• Declare an array of ten elements
• Print the array
• Pass the array to a function
• Have the function arrange the array in descending order
• Print the rearranged array inside the function
• Print the array in the main program

You will notice that that the main array is also rearranged.
Okay, if your instructor is using printf and scanf, then you are in a C class. Anyway, you declare an array with this line of code: int one_d_array[5];
That is an array of 5 int values. Yours could be called int sum_numbers[11]; and then you could increment each time it calls rand() like this:
die1 = (rand() % 6) + 1;
die2 = (rand() %6) +1;
sum = die1 + die2;
sum_numbers[(sum - 2)]++;

and run that 100 times.
Oh, and
#include <people>
You = &you;
return ':)';
I tried the second code, but I'm not sure if this is right, I keep getting an output of regular order and instructions call for descending. Whats wrong?

#include <stdio.h>

void descending(int[]);
int main()

int i;
int a[10]= {1,9,23,3,2,12,0,3,7,8};
printf( "\nArray is:\n");
for(i=0; i<=9; i++){
printf("%2d", a[i]);
descending (a);
return 0;

void descending ( int b[10]){
int i, j, hold;
for (i=0;i<=8;i++){
for (j=0;j<=8;j++){
if (b[j] < b[j+1]){
hold = b[j];
for (i=0;i<=9;i++){
printf("%4d", b[i]);
Topic archived. No new replies allowed.