Issue running code in Visual Studio

Hi,
I have written part of a program for an assignment for a class, i wrote it in XCode on a desktop mac, but needed to work on it on a laptop, so i created a project in Visual Studio and put in my code. When i run the program on the mac it outputs in a few seconds and runs the program as i desire. But in Visual studio it takes minutes to run and does not output the same thing.

Why could this be happening? I tried running my code in an online compiler and it works, and ive tried it in Netbeans and it works. Why is it that the code does not run correctly in Visual Studio?

Here is a link to my code:

http://cpp.sh/3crbc
Your code works fine in vs2013. It completed in about 15 seconds on my machine.
Thanks for the response. My version is 2012. What could be the reason that it does not run correctly for me ?
closed account (48T7M4Gy)
Runs OK on the shell.

It has cropped up here before that the solution maybe to try a clean/rebuild etc compile etc.
Like @kemort said, it's most likely how you're setting up a new project. I haven't used anything past VS2010 but I'm going to assume it's very similar.

Go to
New Project ->
Visual C++ ->
Win32 Console Application -> (and type in the name of the file you want)
Next -> (do not click finish, it will include some extra libraries or components that may be causing your problem)
Check the box that says Empty Project
VS2013 debug and release 32bit < 20 secs
VS2010 debug and release 32bit < 20 secs

VS2013 debug and release 64bit > 1 minute aborted.
VS2010 debug and release 64bit > 1 minute aborted.

curious. your only variables are int's all 32 bits regardless of build on my win7x64 box.
rand() yields an int and you always modulo it so thats ok too.

I recommend you replace your text out with some timestamped debug logging so you can see it in action and compare 32/64 behaviours.

It may feel like a drag but it will develop your skillz :)




Topic archived. No new replies allowed.