PCLP2/lab03/02.cpp

38 lines
617 B
C++
Raw Permalink Normal View History

2020-03-20 08:03:34 +00:00
#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;
}