A common topic i'm sure. I've managed to make my program compile but it comes up with a very strange error in the console when i try to use it. feel free to correct my notes and what not im a complete newbie.
the error is "unknown pseudo relocation protocol versoin %d.
ngw runtime failure."
i have tried to find an answer but i do not understand them, as far as i can comprehend is somthign to do with a char somewhere.
#include <iostream> //include cin/cout and other functions
#include <sstream> //stringstream functions used for parsing a string
#include <string> //string related functions
#include <algorithm> // manipulation functions such as min/max and changing strings
#include <iterator> // used to sort through the vector string list
#include <vector> // functions for vectors
usingnamespace std;
vector<string> parse(const string &s, char delim){ // the parsing function
vector<string> elems; // creating a vector container
stringstream ss(s); // creating a stringstream, needed for the parsing
string item;
while(getline(ss, item, delim))
{
elems.push_back(item); // moving through each word
}
return elems;
}
int main(){
cout << "Enter a Phrase" << endl << "--------" << endl;
string input = "";
string vowels = "aeiou";
string piglatinword = "";
int z = 0;
getline(cin, input); // more efficient than cin can perform more operations on the input
vector<string> sentance = parse(input, ' '); // parsing the input string by ' ' and placing it in a vector container
vector<string>::iterator itr; // turns the vector container into an iterator
for(z = 0, itr = sentance.begin(); itr != sentance.end(); z++, itr++){ // each word in the iterator is assigned to the string word as they are processed
string word = *itr;
for(z = 0; z < vowels.length(); z++){ // work through all the letters in the vowel string
if(word[0] == vowels[z]){ // if the first letter is a vowel
word + "ay";
piglatinword = word;
}
}
for(z = 0; z < vowels.length(); z++){ // work through all the letters in the vowel string
if(word[0] != vowels[z]){ // if the first letter is a vowel
piglatinword = word.substr( 1 );
piglatinword += word[ 0 ];
piglatinword += "ay ";
}
}
}
for(unsignedint i = 0; i < piglatinword.size(); i++){ // this is listing the words from the vector
cout << piglatinword[i] + " ";
}
return 0;
}
gnu gcc compiler, the defualt one from code:blocks, interesting that you didnt have that problem, does it work properly for you? i will read that in a bit i have to paperwork to do, then ill get back to you. Thanks
the page you directed me to seems to indicate that either of the for() lines could be responsible, something to do with characters not having a value? im not really sure i understood it all that well.