Answered a few red squiqly lines

kemp1

New member
Joined
Sep 14, 2020
Messages
2
Programming Experience
Beginner
Is it normal to see this many lines or what and where am i going wrong
(first time)
Capture.PNG
 
It's not usual, but it would be normal if you had done particular things wrong before that. There's a lot there that is obviously wrong. Either you have copied and pasted some garbage from the internet, possibly without having done certain things that it expects prior, or you've just kept on writing "code" despite the compiler flagging issues with it. Maybe go back to when you had code that worked, start making changes to it one by one and stop when an error is flagged. We can then address that error and probably stop you getting loads more for the same reason.
 
It could be as simple as accidentally deleting an opening curly brace, making all code that follows invalid.
 
To me it looks like pseudo code that the OP just copied and pasted in and expected it to just compile and run.
 
True, code itself doesn't look good.
 
Welcome to the forums.

Where did you get the code from?

Where did you paste the code? Ie inside what block of code?

Maybe it would be better if you show all of your code above the code you just posted?

Also don't post screenshots of code. Post your actual code on the forums, by adding your code in code tags.
 
Also don't post screenshots of code. Post your actual code on the forums, by adding your code in code tags.
I think that the screenshots were reasonable in this case, in order to show all the error flags. That said, any case where screenshots of code are reasonable should still include the code posted as text as well, so that we can copy and paste it ourselves to test if required. I would also like to provide corrections for the obvious issues in that code but, in order to do that, I now have to write the whole lot from scratch instead of starting with what's there and just correcting what's wrong. When strangers are volunteering their time to help you, making them do more work than is necessary is not the best way to encourage them to continue doing so.
 
I'd prefer to see the codefile myself than a screenshot of it. If there are reports of squiggles, then we know it's obviously something wrong with code structure. I can work that part out for myself without any screenshot. Anyway, I was thinking the same thing, that the code is dumped outside of a method, or class or there is some un-closed tag as pointed out above.
 
I suspected that the code was in the wrong place at first but the fact that Console.WriteLine is not underlined suggests that that is not the case. I think it's just that there's so much garbage in there. There's enough there to get the gist of what it should be though.
C#:
int hours;
int payRate;
int total;

Console.WriteLine("How many hours do you work?");

hours = Convert.ToInt32(Console.ReadLine());

Console.WriteLine(hours);
Console.WriteLine("What is your rate of pay (per hour)?");

payRate = Convert.ToInt32(Console.ReadLine());
total = payRate * hours;
That's a start. There's a whole lot of other garbage there, including blocks without braces, lines without semicolons, undeclared variables, incorrect logic, etc. There's more work to be done but I think the main problem here is just a fundamental lack of understanding of how to write C# code. Someone needs to go back and learn the basics.
 
Back
Top Bottom