chore: Lab03
This commit is contained in:
parent
ea891cfa03
commit
33ca09b6c6
37
lab03/02.cpp
Normal file
37
lab03/02.cpp
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user