chore: Lab03

This commit is contained in:
Fándly Gergő 2020-03-20 10:03:34 +02:00
parent ea891cfa03
commit 33ca09b6c6

37
lab03/02.cpp Normal file
View File

@ -0,0 +1,37 @@
#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;
}