WHILE Loop - Identify Input of Vowels, spaces and Words.

I need this in <stdio.h> and/or <string.h> and only in WHILE-Loop format! I suck in programming and i need someone to make it for me :(

Create a program that will ask a sentence then it will count the total spaces and no. of words. If the vowel exceeds with 5 letters then it will display the sentence in reverse order.

SCENARIO 1:

Input a sentence: the big bad wolf

Display: the big bad wolf

Total vowels: 4
Total Spaces: 3
Total Words: 4

SCENARIO 2:

Input a sentence: the quick brown fox jump over

Display: revo pmuj xof nworb kciuq eht

Total vowels: 8
Total Spaces: 5
Total Words: 6

please i need a running program for this or I will fail Programming class 2nd year in a row, im only a marketing student working by myself.....

Last edited on
I would make a string variable to hold the input. And then I would make 3 int variables to hold the vowels count, spaces count, and words count.

When you store a sentence like "the big bad wolf" into a string, the string acts like an array of characters. No, it IS an array of characters.

So if you cout arr[1], it would be "t". arr[2] would be "e". arr[3] would be a space.
That should really help...

When you say while-loop is required, I imagine you need it to run until the user wants it to stop...?

try to solve it for 1 scenario, and just put all that code into a while loop.

1
2
3
while (word != "1"){
     //some code 
}
....where word is the name of the string variable you made to store the user's input. If user entered 1, or some other value you want to represent quitting, then the program will end. Else, the program runs forever.

Edit: ...but I missed that <stdio.> part, lol...This solution wont help u much.
Last edited on
aww i seriously need a working program darn it, this is my worst possible subject. i cant ever pass this class! you will have my heart felt gratitude if someone creates this program for me
you will have my heart felt gratitude if someone creates this program for me

Okay, all done. Here's the link:

C:\Code\C++\C++Forums\Homework\johnakaagila\main.cpp

PM me your email and I'll email you my bank info where you can wire your "gratitude".

In case you couldn't catch the sarcasm, we won't do your homework for you.Try to do it yourself, then we'll help you.
someone helped before, i couldnt figure out last time either, and this was only the second time i asked for help....

people are bored and have time to kill and i would really appreciate it if some would like to take up the challenge on this program. but dont assume i havent tried yet. im horrible at programming period ._.
I imagine a lot of the people on here were terrible at one point or another. They didn't just wake up good at this.

people are bored and have time to kill

People are bored and have people to kill too, does that justify murder, no. It is unethical to do someone's assignment for them either way.

dont assume i havent tried yet

This is something we can work with. Post what you have so far, ask us questions about what you have.

Edit:
I can't believe I forgot to mention that a lot of people on here have other commitments (work, school, life etc...). Silly me.
Last edited on
Topic archived. No new replies allowed.