Hi, I'm currently learning C++ and I have this PigLatin program to write, and while everything compiles and there are no errors.. I can't seem to get the string I am passing in to print out in its PigLatin translation. This is my very first post so excuse me if I do not post the code correctly.
#include "stdafx.h"
#include "PigLatinH.h"
#include <iostream>
usingnamespace std;
string preamble = "We the People of the United States in Order to form a more perfect Union establish Justice insure domestic Tranquility provide for the common defence promote the general Welfare and secure the Blessings of Liberty to ourselves and our Posterity do ordain and establish this Constitution for the United States of America";
int main()
{
PigLatinH translate;
cout << "Pig Latin form of the Preamble of the Constitution: " << endl;
translate.PigLatinString(preamble);
system("Pause");
return 0;
}
int main()
{
PigLatinH translate;
cout << "Pig Latin form of the Preamble of the Constitution: " << endl << // Note << instead of ;
translate.PigLatinString(preamble);
system("Pause");
return 0;
}
Hi coder777.. thank you for your reply I tried what
you've suggested and I get an error the error is:
Error 1 error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)
I underlined the operator that caused the error.
1 2 3 4 5 6 7 8 9 10 11 12 13
int main()
{
PigLatinH translate;
cout << "Pig Latin form of the Preamble of the Constitution: " << endl <<
translate.PigLatinString(preamble);
system("Pause");
return 0;
}