Quote:
I don't know how to enter a pic of my code that I have that isn't working!
First off, don't post "pictures of code" - they really aren't helpful because we can't run them without retyping it all, and that introduces its own problems as we can easily make mistakes.
Copy and paste your code, and include it in a code block by using the
code
widget on the toolbar above the text box, or by selecting "
Code block"
from the "
Paste as"
pop-up menu when you paste the code.
Then you get something like this:
#include <stdio.h>
int main()
{
printf("Hello World");
return 0;
}
Which means we can read your code exactly as you typed and tried to compile it, and if necessary copy and paste it directly into a compiler and try it! Just don't give us a whole 400 page app: give us the relevant fragments so we can focus on the error area rather than trying to work out where it might be.
Secondly, think about what you are trying to ask: remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with - we get no other context for your project.
So when you ask a question which is just
Quote:
C program to give user 3 tries to enter correct phone number use a while loop and if else statements
It really doesn't tell us much at all:
1) We know it's language: C - but you told us that in the tags.
2) It has something to do with a
while
loop and an
if
condition, but what makes a phone number "correct" we have no idea.
3) We don't even know if your code compiles, let alone runs and does something unexpected!
Imagine this: you go for a drive in the country, but you have a problem with the car. You call the garage, say "it broke" and turn off your phone. How long will you be waiting before the garage arrives with the right bits and tools to fix the car given they don't know what make or model it is, who you are, what happened when it all went wrong, or even where you are?
That's what you've done here. So stop typing as little as possible and try explaining things to people who have no way to access your project!
Start here:
Asking questions is a skill[
^] and think about what you need to know, and what you need to tell us in order to get help.
I'm going to assume that your code doesn't run because that's the normal problem for a beginner: they try to compile the code and the system throws then a lot of error messages instead of running the app.
That's normal: you should expect to get syntax errors every day, probably many times a day while you are coding - we all do regardless of how much experience we have! Sometimes, we misspell a variable, or a keyword; sometimes we forget to close a string or a code block. Sometimes the cat walks over your keyboard and types something really weird. Sometimes we just forget how many parameters a method call needs.
We all make mistakes.
And because we all do it, we all have to fix syntax errors - and it's a lot quicker to learn how and fix them yourself than to wait for someone else to fix them for you! So invest a little time in learning how to read error messages, and how to interpret your code as written in the light of what the compiler is telling you is wrong - it really is trying to be helpful!
So read this:
How to Write Code to Solve a Problem, A Beginner's Guide Part 2: Syntax Errors[
^] - it should help you look at those error messages and work out what they mean a little better.
If it isn't a compilation problem, then we need to know a lot more about what the code is meant to do, what it actually does, what you did to cause it, and what have tried to do to fix it - along with teh relevant code fragments itself, of course!
Quote:
I'm a COMPLETE BEGINNER
We all had to start there once! Just stop panicking, calm down, and think logically about it.
If you can't work it out at all, then follow the links above and this one:
How to Write Code to Solve a Problem, A Beginner's Guide[^] and feel welcome to come back to us with a better problem description later.
Sorry that doesn't immediately solve your problem, but our hands are tied without the relevant information! Good luck!