Click here to Skip to main content
15,897,226 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
#include<iostream>
#include<string>


using namespace std;

int main(){
string sSentence;
sSentence = "this is a string";

int iVowel = sSentence.find_first_of("aeiou");

while(iVowel!=string::npos){

}
}



so this is the unfinished code.

The program that was tasked of us was so make a program about piglatin:

first find the first vowel of a word
put all the characters before the first vowel after the last letter of the sentence then add "ay"
example: coding ==== odingcay

Problems:
1. after finding the first vowel, how do I get the characters before the first vowel.

2. after translating the word, how do I jump to the next word. (I was thinking of using the blank space as the starting point when finding the next first vowel of the word but I dont know how to find that space).

pls help. thank you :)
Posted
Comments
KarstenK 18-Feb-15 13:23pm    
You should do your homeworks to learn programming. A tip: strings are arrays of chars. You can access single chars via text[index].

1 solution

The string class has many useful member functions that can manipulate its content, as described at https://msdn.microsoft.com/en-us/library/syxtdd4f.aspx[^]. Getting familiar with MSDN is always useful to a developer.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900