Program 1:

#include <iostream>
using namespace std;
using namespace std;

void get_guess(void);   // prototype

int guess;

int main(void) {

	 char correct_guess = 'N';

	 while (correct_guess == 'N') {

       get_guess();
		if (guess == 5) {
			 cout << "You guessed the secret number\n";
			 correct_guess = 'Y';
		} else {
			cout << "Sorry you did not guess correctly. Try again\n";
		}

	 } // end while

	return 0;

}

void get_guess(void) {

		cout << "Enter a number between 0 and 10 ";
		cin >> guess;

}

Program 2:

#include <iostream>
using namespace std;

int get_guess(void);   // prototype

int main(void) {

	 int guess;
	 char correct_guess = 'N';

	 while (correct_guess == 'N') {

       guess = get_guess();
		if (guess == 5) {
			 cout << "You guessed the secret number\n";
			 correct_guess = 'Y';
		} else {
			cout << "Sorry you did not guess correctly. Try again\n";
		}

	 } // end while

	return 0;

}

int get_guess(void) {

		int local_guess;
		cout << "Enter a number between 0 and 10 ";
		cin >> local_guess;
		return local_guess;

}


Program 3:

#include <iostream>
using namespace std;

int get_guess(void);			// prototype
char check_guess(int my_guess);	// prototype

int main(void) {

	 int guess;
	 char correct_guess = 'N';

	 while (correct_guess == 'N') {
        guess = get_guess();
        correct_guess = check_guess(guess);
	 } // end while

	return 0;

}

int get_guess(void) {

		int local_guess;

		cout << "Enter a number between 0 and 10 ";
		cin >> local_guess;
		return local_guess;

}

char check_guess(int my_guess) {

		char correct;

		if (my_guess == 5) {
			 cout << "You guessed the secret number\n";
			 correct = 'Y';
		} else {
			cout << "Sorry you did not guess correctly. Try again\n";
			correct = 'N';
		}

		return correct;

}