Having issue with this syntax error

#include <iostream>

int main()

std::cout << "Welcome to Bulls and Cows\n"; << std::endl;
return 0; 


Hey guys, first post here, hope I could get some help with this problem I’m having.
The issue is after \n"; , these << have a red underline under saying expected an expression. I’ve tried looking up the error itself but nothing pertaining to it comes up. I’m quite new at this, so I’m still getting used to most definitions. Any help would be appreciated.

You dont need the semicolon after \n

should be

std::cout << "Welcome to Bulls and Cows\n" << std::endl;

Ah of course , 'cause that wasn’t the end of the statement, can’t believe I missed such a simple thing. Thanks for taking your time answering Geordan.

No worries. I make simple mistakes like that all the time. Glad i could help. :wink:

Privacy & Terms