Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

vvn347

macrumors newbie
Original poster
Jun 27, 2010
2
0
Hi everyone,

I'm new to C++ programming, and have started learning the language on a compiler on a PC. However, I want to be able to use my Mac, so have set up XCode, and started fiddling around with it.

I find that I'm not able to always use the same statments I would use on my PC in XCode. For example, I use the statement, system ("pause"); on my PC, which makes the program "freeze" the display once the program has run, so that the user can see it. In XCode, it seems that might almost not be necessary, since everything can just be viewed in the consoler. But is there something similar?

Also, when I write code on my PC, I write it in .cpp documents, and then once compiled and run, there is an .exe file that a user can click on to run the program. What is the equivalent output file in XCode, and where can I find them?

Thanks!
 
A few things:
A console is a place to run a program, enter input, and view output. A consoler is one that provides consolation.

The system function runs a program. Pause is not available, as far as I know, on OS X. cin.getch() might be more appropriate.

Your program output from compilation will be in your project's build directory. By default it will be named the same thing as the source file containing your main function, but with no extension.

-Lee
 
Hi everyone,

Also, when I write code on my PC, I write it in .cpp documents, and then once compiled and run, there is an .exe file that a user can click on to run the program. What is the equivalent output file in XCode, and where can I find them?

In the Products folder in the Groups & Files list, there will be an icon for your executable. Right-click on it and choose Reveal in Finder - that will open a window showing the directory it was built in.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.