I stared at it for about a good 30 minutes now and I still can't find anything wrong with it. Can someone help?

/*This program makes all vowels uppercase.                         
  All other constants are lowercase.                               
  Keep in mind I make to call a function                           
  isvowel() to evluate the character.*/                            
                                                                   
#include <stdio.h>                                                 
#include <ctype.h>                                                 
                                                                   
int isvowel(int ch);                                               
                                                                   
int main(void)                                                     
{                                                                  
  int ch;                                                          
  while(ch=getchar()){                                             
    if(isvowel(ch)==1)                                             
      putchar(isupper(ch));                                        
    else                                                           
      putchar(islower(ch));                                        
  }     
  return 0;                                                 
}                                                           
int isvowel(int ch)                                         
{                                                           
  if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u')   
    return 1;                                               
}

Recommended Answers

All 3 Replies

Try saying

int isvowel (int ch)
 {
     if (ch=='a' || ch=='e' || ch=='i' || ch=='o' ||ch=='u')
     return 1;
 return -1;
 }

didn't work

#include<iostream.h>

bool isVowel(char);
char toUpper(char);

int main()
{
     char my_letter;
     cout << "Enter character: ";
     cin >> my_letter;
     cout << toUpper(my_letter);
     return (0);
}

bool isVowel (char letter)
{
     bool to_return = false;
     if ((letter=='a') || (letter=='e') || (letter=='i') || (letter=='o')  || (letter=='u'))
          to_return = true;
     return (to_return);
}

char toUpper(char letter)
{
     if (isVowel(letter)) letter -= ('a' - 'A');
     return (letter);
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.