error stray 253 in program c

I wrote up a string of code that checks if a given number n , is prime or not, and returns true or false accordingly.

When I try to compile it using cygwin with g++ std=c++11 -o PrimeChecker.cpp it gives me a whole lot of errors such as stray ‘253’ in program and stray ‘302’ in program on lines 15, 22, 30 (which are all the lines with the cout statements)

I do not understand what is wrong here. It looks to me as if I have everything written correctly.

1 Answer 1

where two less-than characters are expected:

Not the answer you’re looking for? Browse other questions tagged c++ c++11 or ask your own question.

Hot Network Questions

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2019 Stack Exchange Inc; user contributions licensed under cc by-sa 4.0 with attribution required. rev 2019.11.15.35459

Дубликаты не найдены

К сабжу не относится, но у вас странное представление о чтении файла:
setlocale(LC_ALL,»Russian»);//Чтение файла

А если по делу, проверьте что у вас после cout стоит >> вместо »

#include
#include
#include
#include
#include
#include

I wrote a program using nano and tried to compile it using gcc command on Lx-terminal. It’s showing stray error. Can anyone tell me what is the problem? For simple «hello world» program also is showing errors.

closed as off-topic by Jacobm001 ♦ , Steve Robillard Apr 11 ’16 at 15:51

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • «This question does not appear to be specific to the Raspberry Pi within the scope defined in the help center.» – Jacobm001, Steve Robillard

If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

The problem is with your printf line.

you are missing the closing parenthesis «)«, You are also missing quotes around the text «Hello World»

change that line to:

Your final code should look like this

You can then compile it with this command:

You should now have an executable called helloworld that can be run by typing:

Оцените статью