Hello. I am doing an assignment for my Intro to Programming class. Our instructor provided us with the start of this program, and we were assigned to finish it. My code below runs, but when it gets to "printf("Enter L or R for Large or Regular loaf size.");" the program crashes and gives a Runtime Library error that says:"
Did you paste the wrong code? This is a C program, though clearly you stated multiple times you are using C++.
The error you are getting means you have made a mistake in your code that can only be detected at runtime. Use your IDE's built-in debugger to find the exact line of your code that is causing the crash, and examine the value of various variables to see what is going on.
By the way, if you haven't already, consider upgrading to Visual Studio 2015.
Yes, we're talking about the same thing. When the program crashes, the IDE should turn into a debugger interface that you can use to examine the state of variables. You can also set a breakpoint right before where you know it crashes. There are plenty of useful guides online for how to use the debugger if you're not familiar.
Okay, I ran the debugger and the error is on the last line (19 in this post) of stdio.h, which I pasted the last section of below.
Like I have mentioned already, I am a beginner, so I'm afraid to alter this file without knowing what I'm doing. Is this something I may have accidentally altered without noticing, or something else?
The error is not in the code of any header you are using, it is in code you have written yourself. The debugger can be confusing sometimes - remember that since you are using functions from that header, a mistake in your code can cause the code in that header to malfunction. You should step up the call stack until it gets to a line of code you have written.