1. Engineering
  2. Electrical Engineering
  3. write a program that generates an abridged version of a...

Question: write a program that generates an abridged version of a...

Question details

Write a program that generates an abridged version of a multiplication table. Use a double-subscripted array to represent your table. All multiplications from 1 to 9 should be included (i.e., 9*9-81 is largest value in the table). Initialize your array to 0 and have your program populate the array with the proper values. That is, you can assign the value of the (i+1)th row and G+1)th column to ij, i.e, al6]19 54. You dont need to output any data. 8.
04+ statements that perform the following operations: rite the function prototype for a function called exchange that takes two inter ePtr that points to a variable c with type double. pointers to char as parameter list and does not return a value. Programming (hand in C++ code only, make sure that your code works) 6. Use the switch structure to implement the following program: A program inputs a positive integer. If the integer is equal to the value of a coin in cents, the output states the value of that coin. Otherwise, the output states that there is no coin of that value. The possible outputs are shown below: A 1 cent coin is called a penny. A 5 cent coin is called a nickel. A 10 cent coin is called a dime. A 25 cent coin is called a quarter. A 1 dollar coin is called a loonie A 2 dollar coin is called a toonie. There is no x cent coin. (where x is the input integer) An integer is called a prime number if a natural number that has exactly two distinct natural number divisors: 1 and itself. For example, 2, 3,5, 7, 11, 13 are prime numbers. Write a recursive function called is Prime to determine whether an integer is a prime number. The recursive function isPrime has two parameters: the first one is 7. done is a divisor q which is greater or equal to 2 and
u a quarter. 1 1 ubllar coin is called a loonie. A 2 dollar coin is called a toonie. There is no x cent coin. (where x is the input integer) 7. An integer is called a prime number if a natural number that has exactly two distinct natural number divisors: 1 and itself. For example, 2, 3, 5,7, 11, 13 are prime numbers. Write a recursive function called isPrime to determine whether an integer is a prime number. The recursive function isPrime has two parameters: the first one is the test number p and the second one is a divisor q which is greater or equal to 2 and less than p. The function will return 1 if p-q it is better if (q* p), why?) and return 0 if p%g = 0 (note that, in this case, remainder is 0 and p>q). Those two cases are e cases. Then recursively call isPrime(p, q+1). In your main function, prompt user to input a positive number then call the recursive function isPrime(p,2), If the
4 What is the output of the following program if you enter two integers 4 3? Explai n your answer (that is, how the recursion function works). and #include <iostream> using namespace std; int mystery (int, int) int main() int x, y; cout << Enter two integers: cout << The result is << mystery (x, y) << endl return 0 int mystery (int a, int b) if (b 1) return a; else return a 2*mystery(a, b-1):
int x,y cout << Enter two integers: “; cin x>y cout << The result is mystery (x return 0 y) < endl int mystery (int a, int b) if (b1) return a; else return a + 2*mystery(a, b-1): Write one or two lines of C++ statements that perform the following operations: (a) Declare a pointer cPtr that points to a variable e with type double. (b) Write the function prototype for a function called exchange that takes two 5 pointers to char as parameter list and does not return a value. Programming (hand in C++ code only, make sure that your code works) Use the switch structure to implement the following program: A program inputs a positive integer. If the integer is equal to the value of a coin in cents, the output states the value of that coin. Otherwise, the output states that there i no coin of that value. The possible outputs are shown below: A 1 cent coin is called a penny. 6.
media%2F1ac%2F1ac2c753-7727-4cdb-a24a-80
media%2F446%2F4464035b-c547-445d-b27a-90
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution