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:
Note: Use the following statement before you call rand function;
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;
That is an array of 5 int values. Yours could be called int sum_numbers; and then you could increment each time it calls rand() like this: