Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstring>
- #include<conio.h>
- #include <stdlib.h>
- #include<string>
- using namespace std;
- void select(char *items, int count);
- int main(){
- char orig[26];
- char orig1[26];
- char key[26];
- char key2[26];
- //char alpha[26]={'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'};
- char alpha[]="abcdefghijklmnopqrstuvwxyz";
- string set[3];
- int counter;
- int size;
- int i,j;
- for(counter=1;counter<=4;counter++)
- {
- cout << "Enter String: ";
- cin >> orig;
- strcpy(orig1,orig);
- select(orig, strlen(orig));
- strcpy(key,orig);
- if(strcmp(alpha,key)==0){
- if(strcmp(key2,orig1)!=0){
- size=strlen(key);
- if(size==26 ){
- cout << "OK1" << endl;
- }
- else
- cout << "Nope1" << endl;
- }
- else
- cout << "Nope2" << endl;
- }
- else
- cout << "Nope3" << endl;
- strcpy(key2,orig1);
- }
- getch();
- return 0;
- }
- void select(char *items, int count)
- {
- int a, b, c;
- int exchange;
- char t;
- for(a = 0; a < count-1; ++a) {
- exchange = 0;
- c = a;
- t = items[ a ];
- for(b = a + 1; b < count; ++b) {
- if(items[ b ] < t) {
- c = b;
- t = items[ b ];
- exchange = 1;
- }
- }
- if(exchange) {
- items[ c ] = items[ a ];
- items[ a ] = t;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement