Question
Controlling complexity is the essence of computer programming. Write a program that uses the C++ string functionality to count the number of vowels in this
Controlling complexity is the essence of computer programming." Write a program that uses the C++ string functionality to count the number of vowels in this phrase. Q7. Write a function bool xor(bool A, bool B) which returns the Exclusive OR of boolean input variables A and B. Test your function by printing out the full truth table of the function. Q8. Write a method swap(char_all, int i, int i) which swaps element i and element j of a given character array a[). Q9. Write a method reverseString(char s[], int len) which reverses the elements of the character string s. The length of the string is given by the value of len. Your implementation must use your swap function of Q8. Q10. Write a C++ class called Dice. A Dice can be rolled, so that it takes on a new random value 1,2,3,4,5 or 6. A Dice also has a get() method which returns the current value of the dice. Write a programme that makes two Dice objects, rolls each of them and prints out the sum of the values. Now write a programme (e.g. inside main()) that makes two Dice and estimates the probability that the sum of two Dice is greater than 6 (by averaging the results of a large number of rolls).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started