38 lines
617 B
C++
38 lines
617 B
C++
#include <iostream>
|
|
#include <windows.h>
|
|
using namespace std;
|
|
|
|
int main(){
|
|
ios::sync_with_stdio(false);
|
|
|
|
cout<<"Numele elevului: ";
|
|
string nume;
|
|
cin>>nume;
|
|
|
|
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
SetConsoleCursorPosition(hConsole, {17, 0});
|
|
|
|
for(int i=0; i<nume.size(); i++){
|
|
cout<<"*";
|
|
}
|
|
cout<<endl;
|
|
|
|
int tries=0;
|
|
while(true){
|
|
cout<<"Introduce incercarea: ";
|
|
string incercare;
|
|
cin>>incercare;
|
|
tries++;
|
|
if(nume == incercare){
|
|
cout<<"Ai gasit numele din "<<tries<<" incercari."<<endl;
|
|
break;
|
|
}
|
|
else{
|
|
cout<<"Mai incearca!\n";
|
|
}
|
|
}
|
|
|
|
CloseHandle(hConsole);
|
|
return 0;
|
|
}
|