SHARE
TWEET

Untitled

a guest Sep 15th, 2019 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // lab10.cpp : This file contains the 'main' function. Program execution begins and ends there.
  2. //
  3.  
  4. #include <string>
  5. #include <cctype>
  6. #include <iostream>
  7. using namespace std;
  8. int main()
  9. {
  10.     string str;
  11.     int upper = 0;
  12.     int lower = 0;
  13.     int number = 0;
  14.     cout << "Enter any sentence you want\n";
  15.     getline(cin, str);
  16.     while (str != "#")
  17.     {
  18.         if (isupper(str))
  19.         {
  20.             upper++;
  21.             getline(cin, str);
  22.         }
  23.         else if (islower(str))
  24.         {
  25.             lower++;
  26.             getline(cin, str);
  27.         }
  28.         else if (isdigit(str))
  29.         {
  30.             number++;
  31.             getline(cin, str);
  32.         }
  33.  
  34.     }
  35.     cout << upper << " Upper case you have used.\n";
  36.     cout << lower << " Lower case you have used.\n";
  37.     cout << number << "Digits you have used.\n";
  38.     return 0;
  39. }
  40.  
  41. // Run program: Ctrl + F5 or Debug > Start Without Debugging menu
  42. // Debug program: F5 or Debug > Start Debugging menu
  43.  
  44. // Tips for Getting Started:
  45. //   1. Use the Solution Explorer window to add/manage files
  46. //   2. Use the Team Explorer window to connect to source control
  47. //   3. Use the Output window to see build output and other messages
  48. //   4. Use the Error List window to view errors
  49. //   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
  50. //   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
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