The reason you are getting this error message from the compiler is because it is seeing the || operator and expecting to find two "primary expressions", one on each side of the ||. In your case, while(txt == "")
is not a primary expression.
from https://learn.microsoft.com/en-us/cpp/cpp/primary-expressions?view=vs-2019, a primary expression is:
100 // literal
'c' // literal
this // in a member function, a pointer to the class instance
::func // a global function
::operator + // a global operator function
::A::B // a global qualified name
( i + 1 ) // a parenthesized expression
It can be confusing because the compiler looks at your code differently than you do and can have a hard time understanding what you are attempting to write even when it seems obvious to you.
What you were trying to do, write a while loop, is spelled like this in C++
while(condition)
statement
//or
while(condition)
{
statements...
}
The condition can be a compound expression like the one you used
while((txt == "") || (txt == " "))
{
cout << "Please enter the sentence you want to translate.";
cin >> txt;
}