Witam, mam oto sobie taki kod:
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
int main() {
int n;
int num_attempts = 4;
string your_attempt = " ";
int y;
cout << "ROBCO INDUSTRIES (™) TERMLINK PROTOCOL" << endl;
cout << "ENTER PASSWORD NOW" << endl;
cout << endl;
cout << num_attempts << " ATTEMPT(S) LEFT: ";
for (n=0; n<num_attempts; n++) {
cout << "■"; } cout << endl;
cout << endl;
cout << "0xF4F0 VIRAL 0xF5BC MINES" << endl;
cout << "0cF4FC DARED 0xF5C8 LIKES" << endl;
cout << "0xF508 WIRES 0xF5D4 PARTS" << endl;
cout << "0xF514 LINES 0xF5E0 HAREM" << endl;
cout << "0xF520 LIVES 0xF5EC LINED" << endl;
cout << "0xF52C SORTS 0xF5F8 WARNS" << endl;
cout << "0xF538 AGREE 0xF604 THREW" << endl;
cout << "0xF544 FARMS 0xF610 SIDES" << endl;
do { if (num_attempts > 0) {
cout << " > ";
cin >> your_attempt;
if (your_attempt != "AGREE") {
if (your_attempt == "VIRAL" || your_attempt == "LINES" || your_attempt == "LIVES" || your_attempt == "SORTS" || your_attempt == "FARMS" || your_attempt == "MINES" || your_attempt == "LIKES" || your_attempt == "PARTS" || your_attempt == "LINED" || your_attempt == "WARNS" || your_attempt == "SIDES" ) {
cout << "Incorrect! " << "1/5 Characters Right" << endl;}
else { cout << "Incorrect! " << "2/5 Characters Right" << endl;}}
}
num_attempts = num_attempts - 1;
cout << num_attempts << " ATTEMPT(S) LEFT: ";
for (n=0; n<num_attempts; n++) {
cout << "■"; } cout << endl;
} while (your_attempt != "AGREE" && num_attempts != 0);
if ( your_attempt == "AGREE" ) {
cout << "Exact Match! +75 XP" << endl; }
else {
cout << "You have been temporarily locked out! Contact the Administrator!" << endl; }
return 0;
}
Chciałbym uzyskać 2 rzeczy - Po odgadnięciu hasła chciałbym, żeby została zastosowana fukcja eject do napędu CD, oraz wyświetlony tekst.
W momencie wpisania 5krotnie błędnego hasła chciałbym uzyskać pętle 3 minutową blokującą możliwość wpisywania hasła. Oczywiście po upłynięciu 180 sekund info, że wpisywanie haseł zostało odblokowane.