C++ :: Sorting Vowels / Consonants / Digits And Other Characters In A String
Jan 9, 2013
//Sorting Vowels, Consonants, Digits and Other Characters in a String in C++
#include <iostream>
#include <string>
using namespace std;
int main() {
int vow,con,d,s;
vow=con=d=s=0;
[Code] ....
View 2 Replies
ADVERTISEMENT
Jul 14, 2014
In this assignment, you must enter a file and get out of it this:
Summary
Total characters: 8282
Vowels: 2418
Consonants: 3970
Letters: 6388
Digits: 174
Left parentheses: 17
Right parentheses: 17
Single quotes: 17
Double quotes: 14
Other: 1655
Here is my code:
#include <iostream>
#include <fstream>
#include <cctype>
using namespace std;
char ch;
bool isVowel (char);
[Code] .....
View 2 Replies
View Related
Feb 22, 2015
In this program, I am suppose to input a string, then have a menu that I can input A, B, C, D, E. A is suppose to be a function that counts the vowels within the string. B is suppose to be a function that counts the consonants. C. is suppose to display both functions. D. is suppose to let you input a new string. And E. is suppose to just exit the program. I am having trouble with the pointers with the functions, vowCounter and conCounter. My visual basic will not debug it if I choose A, B, or C.
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int* vowCounter(string, int);
int* conCounter(string, int);
[Code] ....
View 5 Replies
View Related
May 12, 2014
I'm trying to make a function that verifies if the char entered is consonant, if not, prompts user to enter another char and when it meets the criteria, return the char. I was able to do this using switch statements (which works, and i'll paste it below) but I wanted to know if there was an easier, perhaps more elegant solution for accomplishing this goal.
char isCons () // data validation for consonants{
char userCons;
bool notCons = false;
cout << "Please enter a consonant: ";
cin >> userCons;
[Code] .....
View 1 Replies
View Related
Apr 20, 2014
My program reads a string of characters. Prints all occurrences of letters and numbers, sorted in alphabetical and numerical order. Letters will be converted to uppercase.Other characters are filtered out, while number of white spaces are counted.
the problem is it crushes when i run the program
Here is my code
#include <iostream>
const int SIZE = 100;
using namespace std;
int main() {
char *pStr, str[SIZE] = "", newStr[SIZE] = "", ch;
int count = 0, i = 0, j;
[Code] .....
View 1 Replies
View Related
Dec 5, 2013
My question is how create a function to remove all vowels defined as characters('a' 'e', 'i', 'o', and 'u') from the array provided to it.
An example of how the function should work:
input: Hello world, how are you?
output: Hll wrld, hw r y?
Code:
int removeVowels(char arr[]) {
int i;
//move through each element of the array
for(i = j; arr[i] != '/0'; i++) {
//if the last character was a vowel replace with the current
//character
[Code] .....
View 9 Replies
View Related
Oct 28, 2014
So I have been assigned a program that counts keystrokes, alphabetical characters, and vowels. I have the program working as desired but I just can't figure out how to make it end upon ONLY the "return" key being pressed.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int main ( void ) {
[Code] .....
View 7 Replies
View Related
Mar 20, 2013
I am writing a program for my class in C++. For this program we are required to use different fuctions and prototypes outside of main. We have to determine the number of characters, lines, sentences, digits, words, etc. in a particular function the user types in.
View 1 Replies
View Related
May 5, 2014
I have to code a simple program who determining the number of Characters (A character could be any alphabets, digits, punctuation marks, or special , Operators ( Operators are those symbols that are used in mathematica expression, such as,'+', '*', '/', '-', and so on.), Uppercase letters (Uppercase characters are those from A..Z) and Numerical digits ( A digit is any of the Hindu-Arabic numerals from 0..9). Why the output is wrong!
#include <iostream>
#include <string>
#include <fstream>
#include <cstdlib>
#include <iomanip>
using namespace std ;
int main() {
char text;
[Code] .....
This is my input file This is a possible factorial function in a programming language called LISP
(defun factorial (n)
(if (< n 2)
1
(* n (factorial (1- n)))))
This is my output:
The number of characters = 113
The number of operators = 3
The number of numerical digits = 3
Uppercase letters = 5
I think that "characters" is wrong, but I do not know why !
View 4 Replies
View Related
Jun 19, 2014
So I'm supposed to create a program that will read off words from a .txt file,and use a function to count the number of vowels in each word and then display the specific vowels and their frequencies. ex. if the word is: butter the output would be:
a:0
e:1
i:0
o:0
u:1
This is what I have so far, but I'm running into some problems.
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
void PrintFrequencies(string str);
[Code]...
View 3 Replies
View Related
Nov 18, 2013
I am working on a code that is suppose to get vowels and consnants from a string. So far i got up to trying to get the vowels from a string. this is what i have so far:
#include <iostream>
#include <string> // includes go into header
using namespace std;
int getword(string word);
int getvowels(string word);
[Code] .....
View 2 Replies
View Related
Jul 31, 2014
program for counting vowels in a string using recursion ?
View 12 Replies
View Related
Feb 11, 2013
I need to write a program using at least one while loop to count and display the amount of vowels in a user input string. This is what I have so far.
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int acounter(0); // Create counters for each vowel
[Code] ....
View 2 Replies
View Related
Aug 13, 2013
how to remove the vowels from the user input.?
View 4 Replies
View Related
Nov 7, 2013
I am looking for a way to sort a string just by the alpha characters, not by the ASCII table. Therefore
string sort(string name) {
sort(name.begin(), name.end());
return name;
}
will not work. And I am looking for the most simple way to go about it!
View 7 Replies
View Related
Mar 25, 2015
I'm trying to write a lot of sample code to practice but I can not figure out how to take a string and sort each character in order of their increasing ASCII codes. I'm getting stuck trying to separate each letter to determine it's ASCII code. I know I have to use an array somehow, So far, this is my code:
#include <stdio.h>
#include <stdlib.h>
#define _CRT_SECURE_NO_WARNINGS
[Code].....
View 4 Replies
View Related
Mar 20, 2014
so my question is i want to print characters,no string just an array of characters,i do this but it s not working,maybe i have to put the '' at the end?
Code:
int main() {
int i;
char ch[5];
for(i = 0; i < 5; i++) {
scanf("%c",&ch[i]);
[Code]...
View 6 Replies
View Related
Jul 6, 2014
Im supposed to find the common characters between two string characters, assuming that the user wont input duplicate letters like ddog. When I run my code I get an output of a question mark upside down. Here is my code with comments on what each part is supposed to do
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
char str1[20], str2[20],remp = '