SHARE
TWEET

Untitled

a guest Jan 25th, 2020 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. #include<string.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     char fullname[100];
  8.     char address[100];
  9.     int lower=0, upper=0, punct=0, alpha=0, digit=0, alnum=0, print=0,spaces=0, length=0;
  10.    
  11.     cout<<"Enter your full name"<<endl;
  12.     cin.getline(fullname,100);
  13.     cout<<"Enter your address"<<endl;
  14.     cin.getline(address,100);
  15.     cout<<endl;
  16.    
  17.     for (int i=0; i<strlen(fullname); i++)
  18.     {
  19.         if (islower(fullname[i]))
  20.         lower++;
  21.        
  22.         if(isupper(fullname[i]))
  23.         upper++;
  24.        
  25.         if(ispunct(fullname[i]))
  26.         punct++;
  27.        
  28.         if(isalpha(fullname[i]))
  29.         alpha++;
  30.        
  31.         if(isdigit(fullname[i]))
  32.         digit++;
  33.        
  34.         if(isalnum(fullname[i]))
  35.         alnum++;
  36.        
  37.         if(isprint(fullname[i]))
  38.         print++;
  39.        
  40.         if(isspace(fullname[i]))
  41.         spaces++;
  42.         length= strlen(fullname);
  43.     }
  44.     cout<<"FOR FULL NAME"<<endl;
  45.     cout<<"Total count for lowercase letters:"<<lower<<endl;
  46.     cout<<"Total count for uppercase letters:"<<upper<<endl;
  47.     cout<<"Total number of punctuations:"<<punct<<endl;
  48.     cout<<"Total number of alphabetic:"<<alpha<<endl;
  49.     cout<<"Total number of number characters:"<<digit<<endl;
  50.     cout<<"Total number of alphanumeric characters:"<<alnum<<endl;
  51.     cout<<"Total number of printable characters:"<<print<<endl;
  52.     cout<<"Total number of spaces:"<<spaces<<endl;
  53.     cout<<"Total number of length of the input string:"<<length<<endl;
  54.    
  55.         for (int i=0; i<strlen(address); i++)
  56.     {
  57.         if (islower(address[i]))
  58.         lower++;
  59.        
  60.         if(isupper(address[i]))
  61.         upper++;
  62.        
  63.         if(ispunct(address[i]))
  64.         punct++;
  65.        
  66.         if(isalpha(address[i]))
  67.         alpha++;
  68.        
  69.         if(isdigit(address[i]))
  70.         digit++;
  71.        
  72.         if(isalnum(address[i]))
  73.         alnum++;
  74.        
  75.         if(isprint(address[i]))
  76.         print++;
  77.        
  78.         if(isspace(address[i]))
  79.         spaces++;
  80.         length=strlen(address);    
  81.     }
  82.     cout<<"\nADDRESS"<<endl;
  83.     cout<<"Total count for lowercase letters:"<<lower<<endl;
  84.     cout<<"Total count for uppercase letters:"<<upper<<endl;
  85.     cout<<"Total number of punctuations:"<<punct<<endl;
  86.     cout<<"Total number of alphabetic:"<<alpha<<endl;
  87.     cout<<"Total number of number characters:"<<digit<<endl;
  88.     cout<<"Total number of alphanumeric characters:"<<alnum<<endl;
  89.     cout<<"Total number of printable characters:"<<print<<endl;
  90.     cout<<"Total number of spaces:"<<spaces<<endl;
  91.     cout<<"Total number of length of the input string:"<<length<<endl;
  92.        
  93.     system("pause");
  94.     return 0;
  95. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top