3-questions-c

QUESTION 1

  1. Using for loops, and vectors or arrays, write a function named word_rev() that reverse any given word. Write your own code, do not use the invert function.Then put this in a program that will:

    • Ask the user to enter a word.
    • Save the entry as word_entered.
    • Call word_rev on the entry
    • Display the reversed entry (word_entered)
    • What is displayed will be your entry in backward

    Submit your .cpp file

QUESTION 2

  1. Write a function named prime() that determine whether or not a given number n (greater thanone) is prime. The algorithm:

    • If n is even then n is not a prime number except n = 2
    • For all odd numbers less or equal to the square root of n, if any of them divide n, then

    n is not primeUse this prime function in a program that:

    • Asks the user to enter an integer
    • Saves the entry as var
    • Calls the function prime() on the entry
    • Displays whether or not the entry is prime

    Submit .cpp file

    1. QUESTION 3
  1. Write a function that turns the lower case characters of a string into upper case characters (Mangoes becomes MANGOES).You can use toupper(char c) function. So your function takes in a string and prints the same string in upper case.Then use this function in a program that requests a phrase from the user and print the entire phrase in upper case.Submit your program .cpp file.

"Is this question part of your assignment? We can help"

ORDER NOW