hey every one,

I am a bit of a n00b here too, so than ks for baring with me.

I am trying to creat a program that conjugates a verb from present tense to past tense. to do so, I need to conert a string to a character type for comparison. My code is below;

/*
Jonathan Thomas 
ITSE 2421 intro to object C++
 begin sudo code:
      function   takes in string variable called "verb"
      function uses string  function verb.length to determine length of string assigns value to size
      compares last value in the string whether it is a consanant or an E 
      function convert string to array
      converts back to string
      if last letter  is 'e' the letter will be dropped and replaced with 'ing' using verb.replace(size,3,ing)
      

*/

#include<iostream>
#include<string>
using namespace std;
void createParticiple(string);
bool isVowel(char);
int main()
{
    string verb;
   
           cout<<"this prgram conjugates verbs into the past participle"<<endl;
           cout<<"please enter a verb in lower case letters NO CAPITOLS!!!"<<endl;
           getline(cin, verb);
           
           createParticiple(verb);
           
           system("pause");
}//end of line
void createParticiple(string verb)
{ 
     int size= verb.length();
   string s2;
  ;
    char lastLetter[1];
    char nextToLast[1];
     
       lastLetter[1]= verb.substr( size-1, 1);
       nextToLast[1]= verb.substr(size-2,1);
       
       
      
        s2="ing";
        
       
       if ( lastLetter== "e" && !isVowel )
       {verb.replace(size-1, 1);};
       
       if (!isVowel && lastLetter!="e" )
       {verb.append(s2);}
       
        
               
     
            
}
bool isVowel(char nextToLast)
{ 
     if (nextToLast=='a' || nextToLast=='e' || nextToLast=='i' || nextToLast=='o' || nextToLast=='u')
      { return true;}
}

> if ( lastLetter== "e" && !isVowel )
You need to actually call the isVowel function, with a parameter.

> in isVowel...
> { return true;}
So what does this return otherwise - random garbage!

but that still doesn't fix the problem of converting the stings to character variable types

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.