I used a c++ online shell to do my coding and my class professor wants us to use pico to the programming. when I transferred my codes to pico, the code wouldn't run at all while two different online shells worked perfectly fine.
for online C++ shells this program runs fine . and i think both shell and pico uses C++ 14 so i dont know why pico is unable to compile it
this is what the error messages are for pico
area_calculator.cpp:13:8: missing terminating " character
area_calculator.cpp: In function `int main()':
area_calculator.cpp:14: error: syntax error before `area'
area_calculator.cpp:14: error: stray '\' in program
area_calculator.cpp:14:29: missing terminating " character
If you have copy pasted the code from the web browser make sure it does not contain additional invisible characters. This doesn't seem to be a problem with this website (at least not for me) so you could try copying the code from your post here in this topic and see if it works better.
@Peter87, as far as I remember, if it is invisible characters, then the message would rather be error: stray '\302'. (Please correct me!)
In this case, and as the error is pointing towards lines 13 and 14, it suspects code, but finds none. So, the most likely fix should be to write:
cout << "<1>calculate area of circle\n";
cout << "<2> calculate area of rectangle\n";
cout << "<3> calculate area of triangle\n";
cout << "type the number of your desired option:\t";
and line 29, it should be:
area = PI * pow(radius, 2);
If this does not work, maybe it is worth to try:
area = 3.1415926 * radius * radius;
Or, if this doesn't work, and pico complains:
area = 3.1415926*(radius*radius);
hi perter i resolve that problem but now i have a problem with how output looks .
gen242@cs04:~> ./area_calculator
<1> calculate area of circle
<2> calculate area of rectangle
<3> calculate area of triangle
type the number of your desired option: 3
Enter the base of the triangle:3
Enter the height of triangle:4 Area of triangle is 6.00gen242@cs04:~>
so the output is showing without the carriage return where i bolded it