x.Hmking on a program and in a text file I added 1111 to make it an acceptable p
ID: 3617424 • Letter: X
Question
x.Hmking on a program and in a text file I added 1111 to make it an acceptable pin number but when i enter 11111 it is recognized as a valid pin number. I tried 1112 and returned an error as it is supposed to so that is correct. I will give the code that you may need to look at because my code has gotten too big...I am first going to give you my int main code then code of asking for a pin number//Begin coding the program
#include <iostream>
#include <iomanip>
#include <time.h>
#include <fstream>
#include <conio.h>
#include <string>
using namespace std;
//Function prototypes
void showMenu();
int mainMenuSelection(int);
void welcomeScreen();
double enterAmountScreen(double);
int anotherTransactionScreen(int);
void goodbyeScreen();
void wait(int);
int dataEntryScreen();
void timeStamp();
//void withdrawMax();
/*
******************************************************************
******************************************************************
** MAIN FUNCTION *
** int main function *
******************************************************************
******************************************************************
*/
int main ()
{
//Declare variables
int choice;
//Set the numeric output formatting
cout << fixed << showpoint << setprecision(2);
//Function for welcome screen
welcomeScreen();
//Give space for the function of date and time
cout << endl << endl;
//Prompt to show today's date
cout << "Today's date is: " << endl;
//Show date and time function
timeStamp();
//Enter some space
cout << endl << endl;
//Function to enter a pin number
choice = dataEntryScreen();
//if statement for choice
if (choice == -1)
//Return a value
return 0;
//Create a dowhile loop
do
{
//Display the menu and get the user's choice.
showMenu();
cin >> choice;
//Validate the menu selection.
while (choice < 1 || choice > 5)
{
//Prompt user to reenter a correct choice
cout << "Please enter 1, 2, 3, 4, or 5: ";
cin >> choice;
//add color to error message
//add color to error message
system ("Color 3a");
}
//Function to choose in the main menu selection
mainMenuSelection(choice);
//End the while statement
} while (choice != 5);
//Function returns a value
return 0;
}
Here is my pin number information...
/*
***********************************************************
***********************************************************
* Enter pin *
* Function to enter a pin number *
***********************************************************
***********************************************************
*/
int dataEntryScreen()
{
//Declare variables
bool found;
string valid;
char pin[4];
int pinChoice,
i,
j;
ifstream Input;
//Perform dowhile loop to check for correct validation
do
{
//Display the output
cout << " Data Entry Screen";
cout << endl << "1) Enter pin number";
cout << endl << "2) Exit the ATM";
cout << endl << "Please enter a selection: ";
cin >> pinChoice;
//add color to background of data entry screen
//add color to text of data entry screen
system ("Color 3c");
/*
**********************************************
**********************************************
* Check for validation *
* Use while statement *
**********************************************
**********************************************
*/
while (pinChoice < 1 || pinChoice > 2)
&
Explanation / Answer
x.Xlor="red">Please rate - thanks the code assembled--I've commented out the calls to the undefined functions //Begin coding the program #include #include #include #include #include #include using namespace std; //Function prototypes void showMenu(); int mainMenuSelection(int); void welcomeScreen(); double enterAmountScreen(double); int anotherTransactionScreen(int); void goodbyeScreen(); void wait(int); int dataEntryScreen(); void timeStamp(); //void withdrawMax(); /* ****************************************************************** ****************************************************************** ** MAIN FUNCTION * ** int main function * ****************************************************************** ****************************************************************** */ int main () { //Declare variables int choice; //Set the numeric output formatting coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.