#include <stdio.h>
#include <time.h>
#include <stdlib.h>
main()
{
printf("Viberite punkt\n");
printf("**************\n1.Tolko chisla\n2.Tolko Bukvi\n3.Bukvi i chisla\n4.Bukvi, chisla i simvoly\n");
int w;
scanf("%d",&w);
printf("Vvedi chislo simvolov\n");
int a;
scanf("%d", &a);
srand(time(NULL));
switch(w)
{
case 1://chisla
{
int x,b;
for(x=0; x<a; x++)
{
b=rand()%10;
printf("%d",b);
}
return 0;
}
case 2://tolko bukvi
{
int c[]={
65,66,67,68,69,70,71,72,73,74,75,76,77,
78,79,80,81,82,83,84,85,86,87,88,89,90,
97,98,99,100,101,102,103,104,105,106,107,
108,109,110,111,112,113,114,115,116,117,
118,119,120,121,122
};
int x,b;
for(x=0; x<a; x++)
{
b=rand()%52;
printf("%c",c[b]);
}
return 0;
}
case 3:
{
int c[]={
48,49,50,51,52,53,54,55,56,57,
65,66,67,68,69,70,71,72,73,74,
75,76,77,78,79,80,81,82,83,84,
85,86,87,88,89,90,97,98,99,100,
101,102,103,104,105,106,107,108,
109,110,111,112,113,114,115,116,
117,118,119,120,121,122
};
int x,b;
for(x=0; x<a; x++)
{
b=rand()%62;
printf("%c",c[b]);
}
return 0;
}
case 4: //Bukvi, chisla i simvoly
{
int c[]={
33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,
63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,
78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,
93,94,95,96,97,98,99,100,101,102,103,104,105,
106,107,108,109,110,111,112,113,114,115,116,117,
118,119,120,121,122,123,124,125,126
};
int x,b;
for(x=0; x<a; x++)
{
b=rand()%93;
printf("%c",c[b]);
}
return 0;
}
}
}
|