Hello can anyone convert this to <conio.h>/printf and scanf style
Can someone convert this to printf and scanf type? Im having trouble doing it.
Code:
#include <iostream>
#include <string>
int main()
{
//keep track of while loop
bool correct = true;
//Password user must enter to unlock
int password = 123;
//password user is entering
int enteredPassword;
//number of times user can enter password
int numTries = 0;
//continue asking until correct or 3 limit reached.
while(correct == true)
{
std::cout << "Password Checker" << std::endl;
std::cout << "Please enter your password." << std::endl;
std::cin >> enteredPassword;
if(enteredPassword == password)
{
std::cout << "Correct password!" << std::endl;
correct = false;
}
else
{
std::cout << "Wrong password!" << std::endl;
numTries++;
std::cout << "Attempted ";
std::cout << numTries;
std::cout << " out of 3." << std::endl;
if(numTries == 3)
{
std::cout << "Too many password attempted!" << std::endl;
correct = false;
}
}
}
return 0;
}