Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <stdlib.h>
- #include <time.h>
- #include <ctype.h>
- using namespace std;
- int n;
- int l = 0;
- bool ans = false;
- int GetRandomnum();
- /////////////////////////////////////////////////////////////////////
- int main() //
- {
- srand(time(0) );
- cin >> n;
- char *sz2 = new char[n];
- cout <<"enter messages" << endl;
- cin >> sz2;
- char ABC[49] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_.,0123456789";
- char abc[] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','_','.',',','0',
- '1','2','3','4','5','6','7','8','9' };
- for(int j = 0; j < n; j++)
- {
- ans = isupper(sz2[j]);
- if(ans == true)
- {
- sz2[j] = ABC[GetRandomnum() + j];
- }
- else
- {
- sz2[j] = abc[GetRandomnum() + j];
- }
- }
- cout << sz2;
- }
- ///////////////////////////////////////////////////////////////////////
- int GetRandomnum() //
- {
- int num = rand()%26 + 1;
- return num;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement