Program not working.
17 minutes ago, Kosios said:This is a C program does in Visual basic 2016
I'm going to assume you mean Visual Studio. Visual Basic is a programming language, Visual Studio is an IDE to write and run code (among other things).
Also, there is no Visual Studio 2016. There's a VS 2015 and a VS 2017 currently approaching release. I haven't used 2017 yet but I'll assume it's similar to 2015 when running command line apps. So the below information will probably apply either way.
If my assumptions are incorrect, then sorry my mistake, and the below may not apply to you.
17 minutes ago, Kosios said:The program seems to work, however when it displays the average of all 3 numbers it immediately closes on its own. Is there something wrong?
If you're running the application from Visual Studio, and if running a C command line app is anything like running a .NET one, then the process when you run with a debugger is
- Open command line window
- Run application
- Close command line window if the program finishes
You can stop it from closing in a couple ways
- If you're running in debug mode, you can set a breakpoint at the end of your main function
- You can also run your code without the debugger. There's a "Start Without Debugging" option. It'll keep the command line open with a "Press any key to continue..." to close it.
- You can also get user input at the end of your main method. This will keep the command line open until it receives input.
- You can also run the compiled executable directly from the command line
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now