Noob help!

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2003
Posts: 2
Reputation: Weezer is an unknown quantity at this point 
Solved Threads: 0
Weezer Weezer is offline Offline
Newbie Poster

Noob help!

 
0
  #1
Oct 9th, 2003
I stared at it for about a good 30 minutes now and I still can't find anything wrong with it. Can someone help?

  1.  
  2. /*This program makes all vowels uppercase.
  3.   All other constants are lowercase.
  4.   Keep in mind I make to call a function
  5.   isvowel() to evluate the character.*/
  6.  
  7. #include <stdio.h>
  8. #include <ctype.h>
  9.  
  10. int isvowel(int ch);
  11.  
  12. int main(void)
  13. {
  14. int ch;
  15. while(ch=getchar()){
  16. if(isvowel(ch)==1)
  17. putchar(isupper(ch));
  18. else
  19. putchar(islower(ch));
  20. }
  21. return 0;
  22. }
  23. int isvowel(int ch)
  24. {
  25. if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u')
  26. return 1;
  27. }
Reply With Quote Quick reply to this message  
Join Date: Sep 2003
Posts: 81
Reputation: Valmian is an unknown quantity at this point 
Solved Threads: 0
Valmian Valmian is offline Offline
Junior Poster in Training

Re: Noob help!

 
0
  #2
Oct 10th, 2003
Try saying

  1. int isvowel (int ch)
  2. {
  3. if (ch=='a' || ch=='e' || ch=='i' || ch=='o' ||ch=='u')
  4. return 1;
  5. return -1;
  6. }
Reply With Quote Quick reply to this message  
Join Date: Oct 2003
Posts: 2
Reputation: Weezer is an unknown quantity at this point 
Solved Threads: 0
Weezer Weezer is offline Offline
Newbie Poster

Re: Noob help!

 
0
  #3
Oct 10th, 2003
didn't work
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 12,049
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 129
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is online now Online
The Queen of DaniWeb

Re: Noob help!

 
0
  #4
Oct 10th, 2003
  1.  
  2. #include<iostream.h>
  3.  
  4. bool isVowel(char);
  5. char toUpper(char);
  6.  
  7. int main()
  8. {
  9. char my_letter;
  10. cout << "Enter character: ";
  11. cin >> my_letter;
  12. cout << toUpper(my_letter);
  13. return (0);
  14. }
  15.  
  16. bool isVowel (char letter)
  17. {
  18. bool to_return = false;
  19. if ((letter=='a') || (letter=='e') || (letter=='i') || (letter=='o') || (letter=='u'))
  20. to_return = true;
  21. return (to_return);
  22. }
  23.  
  24. char toUpper(char letter)
  25. {
  26. if (isVowel(letter)) letter -= ('a' - 'A');
  27. return (letter);
  28. }
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC