Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cctype>
- using namespace std;
- void firstChoice(char []);
- int main()
- {
- int choice;
- int answer;
- const int SIZE = 100;
- char line[SIZE];
- do
- {
- cout << "1. Adds numbers but ignores anything thats not a number." << endl;
- cout << "2. Count the number of consonants in a string." << endl;
- cout << "3. Counts the vowels in a string." << endl;
- cout << "4. Counts whitespace characters in a string." << endl;
- cout << "Enter a number to access that program or 0 to end it: ";
- cin >> choice;
- switch(choice)
- {
- case 1:
- cout << "nEnter a string: ";
- cin.getline(line, SIZE);
- firstChoice(line);
- break;
- case 2:
- cout << "Enter a string: ";
- cin.getline(line, SIZE);
- break;
- case 3:
- cout << "Enter a string: ";
- cin.getline(line, SIZE);
- break;
- case 4:
- cout << "Enter a string: ";
- cin.getline(line, SIZE);
- break;
- }
- }
- while(choice != 0);
- return 0;
- }
- void firstChoice(char line[])
- {
- int size2 = 0;
- int sum = 0;
- while(line[size2] != '