-
Programming Help
So i'm basically trying to build a C code for this assignment. (Ignore the red text that's crossed out and any other question that isn't about programming)
Intro, Intro (beginning of A), A, B, B ii
Also in hyperlink A i know it says python but forget about that too, everything is supposed to be in C. I can't get past Section A though as my program won't run. It looks like this. Any suggestions?
-
Learn the difference between == and = when used in C code.
Tim S.
-
Oh, and next time, post actual code between [code][/code] tags.
Just dumping a bunch of urls to screen shots doesn't make a good experience.
-
Why haven't you just named the variables "guestNumber", "length", "isSmoker", "CreditCardNumber"?
That way your code will be self documenting.
If you don't want to do that, at least change "l" - calling a variable "l" is a very bad idea because it looks like a "1"
What is going on here...
Code:
printf("Please Enter Name\n");
scanf
...
Is there more to that scanf?
Also, scanf needs the address of your variable - You do that by putting a "&" in front of it
Code:
scanf("%d", &length);
There are lots of problems with getting strings (i.e. the name) from the user - You just need to look into the history of the "gets" function in the C language.
The best way is to use a function called "fgets". I suggest that you have a look around for tutorials like this:
C Strings - Cprogramming.com
Good luck :)