MP7
Write a program that simulates the rolling of two dice. The program should use the rand() function to roll the first die, and should use rand() again to roll the second die. Record the values of the two faces in a two-dimensional array. Your program should roll the two dice 36,000 times. Print the results in a tabular form. Your program output should look something like the following:
Die2 Die 1
1 2 3 4 5 6
1 1010 1046 1004 983 1022 1074
2 985 1054 993 980 1002 1055
3 1023 1002 998 939 1067 990
4 972 1017 966 1034 982 989
5 954 1007 977 1052 949 997
6 1008 962 1013 948 977 969
Next, based on the results in the two-dimensional array, use a single subscripted array to tally the number of times each possible sum (2, 3, ... ,12 ) appears. Print the results in a tabular form.
Save your program as mp07a.cpp.
Write a program to accept a sentence from the user and count the number of unique words in the sentence. Use the strtok function (in string.h) to make the program functional. See the hint and the strategy for clues on how to solve this nasty problem.
Sentences can be a maximum of 100 characters in length and contain at most 20 unique words.
Problem 2 Sample Interaction (user input is in bold)
Please enter a sentence:
this is a sentence and this is another sentence
The words found in the sentence and their frequency are:
this 2
is 2
a 1
sentence 2
and 1
another 1
Save your program as mp07b.cpp.
A diskette labeled with your name, course # and containing the files mp07a.cpp and mp07b.cpp.