Thursday, July 30, 2009

I need source code of a program(hiding first two vowels in a sentance) in c++?

just modify this code a little...





#include %26lt;iostream%26gt;


#include %26lt;conio.h%26gt;


#include %26lt;string%26gt;


using namespace std;





int main()


{


//Step01: Declare Memory Locations


string Input;


string StripVowels(string);


//Step02: Initialize Memory Locations


int Index = 0;


//Step03: Do the Work


//Step03a: Ask for the Characters


cout %26lt;%26lt; "Please enter characters: ";


cin %26gt;%26gt; Input;


cout %26lt;%26lt; endl;


//Step03b: Output consanants


cout %26lt;%26lt; StripVowels;


//Step04: Wrap up and Exit


cout %26lt;%26lt; endl;


getch();


return 0;


}








string StripVowels(string MyChar)


{


while(Index %26lt; Input.size())


{


if(Input.substr(Index, 1) == "a";


Index++;


else if(Input.substr(Index, 1) == "e";


Index++;


else if(Input.substr(Index, 1) == "i";


Index++;


else if(Input.substr(Index, 1) == "o";


Index++;


else if(Input.substr(Index, 1) == "u";


Index++;


else


{cout %26lt;%26lt; Input.subst(Index, 1) %26lt;%26lt; endl;


Index++;


}


}


}

I need source code of a program(hiding first two vowels in a sentance) in c++?
Your teacher will know you haven't done the work if you can't explain why certain parts of the code are used (if you use the code above)


No comments:

Post a Comment