PCLP2/lab03/02.cpp
Fándly Gergő 33ca09b6c6 chore: Lab03
2020-03-20 10:03:34 +02:00

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;
}