I made a very simple program but even though there is not a semicolon, I still get this error. Please ignore the weird intention of this program, it's for comedy purposes.
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int john, jeff, philip, joe, dave;
cout << "Hello and welcome to the blessing service" << endl;
cout << "please enter your name and god will" << endl;
cout << "decide if you are cursed or blessed" << endl;
cout << "______________________________________" << endl;
cin >> john, jeff, philip, joe, dave;
if (john, jeff, philip, joe, dave)
cout << "you have been cursed, you will have bad luck" << endl;
cout << "for the rest of your life!" << endl;
else
cout << "you have been blessed, enjoy your life" << endl;
cout << "and keep praying to God" << endl;
system ("pause");
return 0;
}
For starters in this expression statement
there is used the comma operator. It is equivalent to
So all the operands after the first operand
do not produce any effect.
It seems you mean
Again in the condition of this if statement
there is used an expression with the same comma operator. The value of the expression is the value of last operand
dave
contextually converted to the type bool.It is unclear what you are trying to check in this if statement.
Nevertheless the following pair of statements should be enclosed in a compound statement like
It seems you mean something like the following
The condition in the if statement can be changed as you like.