#include<iostream> #include<string> #include<ctime> #include<cstdlib> using namespace std; int main() { string odp; do{ srand(time(NULL)); string sa[6]={"a","e","u","y","i","o"}; string sp[20]= {"q","w","r","t","p","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m"}; string zn[9]={"!","@","#","$","%","^","&","*","?"}; string cy[10]={"1","2","3","4","5","6","7","8","9","0"}; string haslo; int n; cout<<"Z ilu znakow ma skladac sie haslo?"<<endl; cin>>n; for (int i=1; i<=n; i++) {if (i==n) haslo = haslo+zn[rand()%9]; else if(i==n-1) haslo=haslo+cy[rand()%10]; else if(i%2==0) haslo=haslo+sa[rand()%6]; else if(i%2!=0) haslo=haslo+sp[rand()%20]; } haslo[0]=toupper(haslo[0]); cout<<haslo<<endl; cout<<"Czy generowac jeszcze raz? (tak/nie)"<<endl; cin>>odp; cout<<endl; for (int i=1; i<=odp.length();i++) odp[i-1]=tolower(odp[i-1]); } while(odp=="tak"); return 0; }