Note that there are some explanatory texts on larger screens.

plurals
  1. PORedo char is undeclared yet it is declared
    primarykey
    data
    text
    <p>I'm getting a error with redo char (in bold) on main.cpp when I obviously declare it above. I also would like to know why its asking me to put a semicolon in front of using namespace std since I've never done that before.</p> <pre><code>//ReverseString.h #include &lt;iostream&gt; #include &lt;string&gt; using namespace std; class StringClass { public: string string; int GetStringLength (char*); void Reverse(char*); void OutputString(char*); void UserInputString (char*); StringClass(); private: int Length; } //StringClass.cpp #include &lt;iostream&gt; #include &lt;string&gt; #include "ReverseString.h" ;using namespace std; void StringClass::UserInputString(char *string) { cout &lt;&lt; "Input a string you would like to be reversed.\n"; cin &gt;&gt; string; cout &lt;&lt; "The string you entered: " &lt;&lt; string &lt;&lt; endl; } int StringClass::GetStringLength (char *string) { Length = strlen(string); return Length; } void StringClass::Reverse(char *string) { int c; char *front, *rear, temp; front = string; rear = string; GetStringLength(string); for ( c = 0 ; c &lt; ( Length - 1 ) ; c++ ) rear++; for ( c = 0 ; c &lt; Length/2 ; c++ ) { temp = *rear; *rear = *front; *front = temp; front++; rear--; } } void StringClass::OutputString(char *string) { cout &lt;&lt; "Your string reversed is: " &lt;&lt; string &lt;&lt; "."; } //Main.cpp #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;fstream&gt; #include "ReverseString.h" ;using namespace std; const int MaxSize = 100; int main() { do { char string[MaxSize]; **char redo;** StringClass str; str.UserInputString(string); str.Reverse(string); str.OutputString(string); //Asks user if they want redo the program cout &lt;&lt; "Would you like to redo the program?\n"; cout &lt;&lt; "Please enter Y or N: \n"; **cin &gt;&gt; redo;** }while(redo == 'Y' || redo == 'y'); } </code></pre> <p>It's really confusing of why its declaring it but giving an error that it isn't declared.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload