[ create a new paste ] login | about

Link: http://codepad.org/XEucYKHe    [ raw code | output | fork ]

C++, pasted on Jan 11:
#include <iostream>
#include <ctime>
#include <stdio.h>

using namespace std;

int main()
{
	char ident[30];
	cout<<dawn;
	cin>>ident;
	int idLen=strlen(ident);

	char num[]="0123456789";
	char sym[]="!\",#$%&'()*";
   
	srand(time(0));

	//длина пароля
    int passLen=11+rand()%10; // Требуемое кол-во символов - 11
	char *password=new char[passLen]; // строка-пароль
	password[0]=sym[rand()%11]; // b1,b2 - случайные символы из множества {!,”,#,$,%,&,’,(,),*}.x
    password[1]=sym[rand()%11];

	int Q=strlen(ident)%8;	

	for(int i=2;i<Q;i++)
	{
		if(rand()%2)
			password[i]=(char)(160+rand()%16);
		else
			password[i]=(char)(224+rand()%16); // b3,...,b3+Q - случайные малые буквы русского алфавита, где Q=Nmod8
	}

	for(int i=Q;i<passLen;i++)
		password[i]=num[rand()%10]; //b4+Q,...,b11 - случайные цифры.

	password[passLen]='\0';

	cout<<"ident = "<<ident<<"\npass = "<<password<<endl;
  
}


Output:
1
2
3
In function 'int main()':
Line 10: error: 'dawn' was not declared in this scope
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: