Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAngus Eliott
3,793 PointsMVS 2017 Build Faliure
I am using Microsoft Visual Studio to do my code and after building it, I launched the program and a console window pops up bearing the program's location as a name and a split second after it launches it closes again here is a onedrive link to the file which will expire on 9/10/2017 or when the question is answered: https://1drv.ms/f/s!ArybRXN2uyfJm0sH0sCg1nTMflRf and here is my code:
`` class Program { static void Main() { // Prompt user for minutes exercised System.Console.Write("Enter how many minutes you exercised: ");
// Add minutes exercised to total
// Display total minutes exercised to the screen
// Repeat until user quits
}
} ``
1 Answer
andren
28,558 PointsIf the command prompt opens up then the code built successfully. The fact that it closes a split second later comes from the fact that your program only takes about a split-second to run, and the command prompt closes automatically once the program is finished.
One way around this issue is to use the "Start Without Debugging" option which can be found in the "Debug" menu, and has the shortcut Ctrl + F5.
If you run your program through that option then it will automatically pause after finishing, and wait for you to hit a key before closing the command window.
Another way is to place a System.Console.ReadLine();
command at the end of your code, that will cause your program to pause as it waits for you to enter some input for that command to read.
Angus Eliott
3,793 PointsAngus Eliott
3,793 Pointswounderful!! thanks andren!