Here is one way to do it in Java:
int countVowels(String s) {
if (s.length() == 0) return 0;
int tailResult = countVowels(s.substring(1));
switch (s.charAt(0)) {
case ‘a’: case ‘e’: case...
Type: Posts; User: Mister C
Here is one way to do it in Java:
int countVowels(String s) {
if (s.length() == 0) return 0;
int tailResult = countVowels(s.substring(1));
switch (s.charAt(0)) {
case ‘a’: case ‘e’: case...
clegs I gave you the recursive sol'n
The base case involves the empty string, which contains zero vowels. For other cases, examine the first letter and add one, if necessary, to the result of...
He means something like...
numChars = str.length()
for (i = 0; i < numChars; i++)
{
switch(str.at(i))
{
case 'a':
case 'e':
The base case involves the empty string, which contains zero vowels. For other cases, examine the first letter and add one, if necessary, to the result of applying the procedure to the substring...
Here is the start of a non-recursive sol'n
int vowel = 0; /* counts the total vowels */
int length; /* length of str */
for ( index = 0; index < length; index++ ) {
if (...
Why don't you try getting to work non- recursively first- then rewrite using recursion?
Two comments
1. Usually it is an if/else with recursion
int vowels(string phrase)
{
if (phrase.empty())
return 0;
Neat site:
http://www.99-bottles-of-beer.net/
Anon is correct
..Bohm and Jacopini in 1960's stated that a Turing compatable language is a language can be used to solve any solvable problem. It was proved by them that in terms of controls...
In C++ with Windows:
static_cast<char>(5);
static_cast<char>(4);
static_cast<char>(3);
static_cast<char>(6);
Thanks, Quazh - I realized I had a mistake after I had posted- but I figured why bother to correct- when I was likely to be bashed anyway...by certain people on this board.
Just wanted to gather...
This question or suggestion involves the use of the return- used here to terminate the code- not as a function returning a value.
This code is found in a C programming book:
void print(int...
That's why alot of instructors who teach programming (myself included) only have about 25-40% grade based on programs...good reasons why stated above...
Most colleges/university usually have...
Well here are some excerpt from the preface of a Alice programming book
Why Alice...
"Alice by itself isn't all useful if our goal is to train people so that they can be professional computer...
Well it does not match the Knuth series...:)
For a cheap copy look online at Amazon or others. If you still live in Georgia Prelude you may check around...some colleges in Georgia have adopted...
Don't get a chance to come to this board much anymore..but would like to still chime in from time to time...
Alice is the new language of choice for many colleges/universities now in teachin...
>15. Can you recommend any good tutorials on OOP and C#?
http://www.csharpcorner.com/
http://www.csharphelp.com/links.html
Or a good search engine...
>16. What about books?
Well I thought it might be time to chime in...
I teach CS at a Two year college.
1. C++ is not dead, a real good CC would offer (programming langs): C++, VB. NET, Java, and C#- Those are...
gL_nEwB
Why don't you look at both books yourself..I would not take one bad review of the Prata book- and then make my decision solely on it.
C++ Prata is a good reference book- not the best-...
Well I meant links do not work- but why do you have them when they link to http://dhost.info/ only. I know they are placeholders but why put all 20 out there. When you have no tutorials to point...
Remember others may not know to view it at that resolution. Good web design means you should design around that fact. It your computer- not mine.
Do google seach- you will see that good web design...
OK, Joe I looked at your site. Some comments
1. you are having (x)html problems- tutorials 2 & 3 are all "squished" together on the left side? Why?
2. Same for your blog- your text/pictures do...
Some critique for you..
1.The black background is hard to read- Not the most user friendly for tutorials.
some comments on your lessons
lesson 5:
Well there are also:
Structure Charts
and
Nassi Schneiderman Diagrams :)
Have not posted here in over 3 months
I teach programming at the 2 year college. This semester C and Java...
Just some comments:
Why cheat?