blob: 9bde0b9a11dc05f551675386eb111d1efd5386aa (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#include "Voids.h"
#include <iostream>
using namespace::std;
void FindDigitAtPosition(int Digit, int Position, int& Number)
{
cout << "\nThe number you have chosen from before is " << Number << ", what position of that number do you want to see where that digit is outputted?\n";
cin >> Position;
}
//the variable that holds the menue choice. pass by value.
//the variable that holds the number entered. pass by reference
//return: none
//purpose: this function will call the appropriate function based upon the menu choice that is passed in
void ProcessMenuChoice(float Choice)
{
cout << "Enter the number corresponding to the function you want to select:\n";
cin >> Choice;
}
//the integer entered by the user
//purpose: this function will allow the user to enter the number to be tested.
//limit the input from negative one million to positive one million.
//if out of bounds, display an error message and re-prompt
void GetData(int& Number)
{
cout << "\n-----Input a number between negative one million and one million to be tested-----\n";
cin >> Number;
while (Number > 1000000 || Number < -1000000)
{
cout << "\nYou did not enter a number in between the designated values, try again: \n\n" << endl;
cin >> Number;
}
cout << "\nYou entered the value: " << Number << endl;
}
//the variable that holds the number entered. pass by value
//return:none
//purpose: this function tests the number that is passed to determine whether it is odd, even, or 0.
//the function displays the appropriate message based upon the results of the test
void IsOddEven(int& Number)
{
cout << "\n\nCalculating if the number entered is even, odd, or 0\n\n";
if (Number % 2 == 0 && Number != 0)
cout << Number << " is even.\n\n";
else if (Number % 2 == 1 && Number != 0)
cout << Number << " is odd.\n\n";
else if (Number == 0)
cout << "This number is a 0.\n\n";
}
|