473,386 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Consonants and Vowels

13
I have an assigment that deals with strings and I just need an idea how to start writing these functions.

Write a function that determines if a string is nice. A string is nice if it has an equal number (including zero) of consonants and vowels.

int isNice(char *str);


Write a function that determines if a string is balanced. A string is balanced if there is the same number (including zero) of vowels in the first half of the string as is in the last half.

int isBalanced (char *str);
Oct 23 '06 #1
1 2125
Banfa
9,065 Expert Mod 8TB
Well in the first case you will need a loop that examines every character in the string and to keep counts of the characters that are vowels and a count of the vowels that are consenants.

In the second case you need a loop that examines every character in the string, if you are in the first half of the string increment the count of vowels, if you are in the second half of the string decrement it. at the end a 0 = balanced (unless the string has a odd number of characters and has a vowel as the centre character)
Oct 24 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Phil Slater | last post by:
I'm trying to process a collection of text files, reading word by word. The program run hangs whenever it encounters a word with an accented letter (like rôle or passé) - ie something that's not a...
5
by: ivalki | last post by:
Hi How do i use the functions found in string.h to check if a letter is vowel and a consonant ? I have this code : ......... const char vowel="aeiou"; const char...
1
by: iloveyousosomuch | last post by:
how do i erase extra white spaces and vowels in c without using string or arrays? I just have to use char... how do i do that?
14
by: teriwalker | last post by:
import java.util.*; import java.lang.Character.*; public class IsVowel { static char vowels = { 'a', 'e', 'i', 'o', 'u', 'y' }; public static boolean isVowel(char s) {
1
by: powerej | last post by:
I have gotten the part of counting how many words are in the string, but the vowels just seem alien to me. Ive tried so many things but never close to a correct answer. I know I need to use...
4
by: Doegon | last post by:
Hi i need help with writing a method that takes in a string of characters and counts the syllables in the string. the method should not count chacter 'e' if its the last character in the string and...
12
by: ashpats | last post by:
Hey everyone, I am supposed to write a program that counts the number of vowels in string of characters. It must include "Struct counter_t (it must be declared as in the code i've written)" and...
2
by: Geneses | last post by:
Hi! I'm using Eclipse as an IDE, I need to code a program where users enter a string and it computes the count for each vowel, and how many words are in the string. Users can do as many strings as...
6
by: HypeBeast McStreetwear | last post by:
Hi I'm supposed to be writing a program that counts in a given text, the words that contain at least three different vowels (a,e,i,o,u) For my test run I have to use "unquestionably", but I can't...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.