it ignores everything after the decimal because you used %d in your scanf's. %d means to scan for a integer value which are whole numbers if you would like to scan in a decimal number, use double...
Type: Posts; User: SimarGill
it ignores everything after the decimal because you used %d in your scanf's. %d means to scan for a integer value which are whole numbers if you would like to scan in a decimal number, use double...
Hey, sorry for the late reply. I did what you said like make all my counters reset to 0 and that worked like a charm. Only question I have now is that how can I make this while loop only run until...
Hey, I have created this program that displays a menu and asks the user to select their option and program will do that option. I tried to make my code as easy to understand but if you need help...
I can sleep now at night. Thank You.
I do it, every single day....I just can't seem to save a user input into an arrays elements starting from index 0 instead I can only save it to a specific index. I have 4 other courses and I try to...
Alright I did that but I still can't option D or P to work. How can I save user inputs in a array?
I am making a program that will make a menu as shown below and so far I am up to option P and can't seem to print out all the positive numbers in the array. And I can't also make it keep looping.
...
When my user enters 'E' or 'e' then it asks them for their input as an integer but now the problem is which index in the array should I save it to knowing that my program will continually run.
...
Yes, you are right and that is exactly what I can't figure out how to actually code the for loop. I am trying to use a for loop right now but can't seem to understand what to actually code it.
...
Yes, I have two different arrays. One for negative and one for positive numbers but if I want to display all the positive numbers the user entered, what would be the syntax. All my arrays are of [10]...
I am creating a program that will continually take in the user inputs and when they press 'q', it will show all the entered user inputs. Assuming that all the inputs are to be integers. What would be...
Yes I experimented and it works perfectly! But I am interested in to see how I can use the tolower function here to make every input to lower case and then proceed as usual.
So that means I would have to put a IF statement to check if the variable is uppercase and if it is then the switch statement should get executed assuming that im using toupper function.
So I am trying to create a program that will take an integer from the user if they enter 'E' or 'e' from the menu. So my code looks like this:
// Menu options: C, c, D, d, E, e and saves the...
Yes, I have downloaded it from my compilers website. And damn it, I spent $150 for that book. :(
Ohh alright I got it. In my book, it just that says that scanf reads an input from stdin stream. The string pointed to by format specifies the format of the items to be read. But I understand now,...
Yes that's right but my teacher always said that to start with c programming, always start from the very basics and do everything the hard way so you understand future concepts much easier after. So...
Ah I got it now. Thanks but in that case, %c can be %d or whatever since it will always be waiting for one sort of input. Or is this issue only with %c. I never had this before.
To put it back to capitals just subtract 32 from the variable that contains the lower case letter. If you look up the ASCII table, you will see that subtracting 32 gives you the capital letter.
LOL ok i got it now, so im basically telling scanf to wait for 2 characters in the buffer since the enter key seems to skip it. Wow, that is a flaw.
Thanks Adak, I just placed a space between " % and it worked perfectly. Still don't understand the whole '\n' and keyboard buffer concept. But I appreciate your help. Thanks though and see you around.
Hello, I am trying to code a basic program which takes 2 inputs from a user based on a menu and then converts the second input to the menu choice chosen. For example, if 'a' is chosen and the number...