Greetings all,

I am getting started with C++ using XCode 4.0.2.

The following was created as a C++ command line tool.  The objective of this 
"main.cpp" code was to accept a n integer from the console and display it:

#include <iostream>
using namespace std;

int main() {
    int  num;
    cout << "Please enter an integer: ";
    cin >> num;
    cout << "Thanks for typing.  You entered: " << num << endl;
}

Upon running this code via command-r I receive the message that output was 
generated.  The log window appears to stop and prompt me as expected -- I see 
the following:

GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:52:12 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys000
[Switching to process 10756 thread 0x0]
Please enter an integer: 

When I enter an integer (e.g. 9) the following text appears:

Please enter an integer: 9
Thanks for typing.  You entered: 60106
Program ended with exit code: 0

Initializing num (ie int num = 0;) causes the garbage to disappear , except 
that the initialized value is always displayed regardless what I enter in 
response to the prompt.

I tried building a unix executable and running it from terminal, but the 
results did not vary.  An item in Google suggested running debug in "standard 
debug" mode, but from what I can find this may no longer be applicable in xCode 
4?

If anyone can offer a suggestion I would be most appreciative.  Perhaps there 
is another list that is mor appropriate for this type of query?

Best regards.
Geoff

-- 
You received this message because you are subscribed to the Google Groups 
"MacVisionaries" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/macvisionaries?hl=en.

Reply via email to