2 simple questions on Xcode for the experts out there

hey.  I have just started programming in C++ and am getting good results in the command line tool in xcode.
I am trying out my own programmes based on what I am learning from a C++ book.  However, there seems to be an issue with one of the things I have learned.
Acording to the book I can use a getline statement to allow a user to input a string with spaces such as a whole sentence instead of one word.
Well when ever I use getline, xcode reports no errors (build succeeded) however it always skips over the getline and moves to the next part of the code.for example,
#include <iostream>
#include <string>
using namespace std;
//This is just a random example.
int main ()
    string first;
    string last;
    cout <<"what is your first name?";
    cin >>first;
    cout <<"what is your middle and last name?";
    getline (cin, last);
    cout <<"hello"  <<first <<" " <<last;
    return 0;
if it is my code please say.  But xcode only excepts my first name then skips right to hello. 
It does not pause to let me input middle and last.  How can I fix this?
Second question is I am viewing everything in the debug console.  How do I get my code to run in terminal?
Thank you so much to everyone that answers.

Saad Attieh wrote:
So how do I get this to run in terminal.app? Will it run any differently?
That is how I ran it. It runs the same.
The easiest way is to just inspect the build output , find the temporary path it uses, and go there. For simple programs like this, you can just type them in with vi and compile with clang++.
Oh yeah and do you know if and how I can use c++ to create a full application in Xcode?  As in what template do I choose?  According to the user guide I have to choose a carbon application template or something like that if I want to make a application with the usual quit and minimise etc buttons.  But I cannot find that so I am feeling very silly.
Also, looking a head into the future what are the best languages to use for coding in Mac OS X?
You should use Objective-C for building MacOS X programs. If you are building command line tools or libraries, you could just use C++. There isn't anything on the Mac that requires C++.
If you really wanted to, you could write the Mac parts in Objective-C and your own routines in C++ and connect them with C linkage. Another option would be to use Objective-C++. The core operating system and especially user interface libraries are all designed for Objective-C. It isn't smart to fight against the system.
In practice, C++ is just an awful language. Anything you might want to use C++ for can be more easily done in Objective-C. I spent 15 years writing C++ software. I really enjoyed it, but I realized that I enjoyed it because it was hard - like a puzzle. That approach isn't conducive to effective software development.

Similar Messages

  • Simple question I think ( for the expert users of this group)

    In a tabular layout form, when I insert a record, I want a database item, for example b1.aa ( b1 is the database block) to begin with 1( if there are no records inserted yet) and increases automatically, like a sequence.
    1,2,3, 4 ....
    how can I do this?
    in a when - new item instance trigger maybe?
    where? on the block or on the item?
    and which is the right code?
    Thank you all

    Hi Champion
    place ur code in when- new- record- instance at block level and increment it with the value required.
    Thank you
    Sasi

  • Is there a working version of xcode for snow leopard out there?

    I downloaded v 4.2 from developer.apple and when I try to install it on my computer it says "unknown installation error occurred" and "you may want to contact the software manufacturer."  It doesn't give me anything else...
    Similarily, I used adobe flash pro to build my .ipa file and am curious if I even need xcode - is there a working version of Application Loader for Snow Leopard available for download?
    Thanks a bunch.

    I need to upload my .ipa file to itunes connect... 
    I have an older mac with snow leopard 10.6.8 and an old version of Xcode (3.2), but no Application Loader to load my .ipa to itunes connect.  The Application Loader you can download in itunes connect requres OS 10.7 or higher, and I I can't upgrade my OS without increasing RAM.

  • Populate repeating table based on task list - Need the experts out there!!!!

    Ok I will try to explain this as best as I can.
    What I have:
    task list (out of the box, with 1 calculated field)
    form library (customized using infopath)
    ....and a headache ;)
    So What ive done so far is I put in a hyperlink in the infopath form to the task lists newitem form "click here for new task" . I have the title of this newitem form prepopulated based on the form library item. For example, if you open up a form
    from the form library Titled: Test Entry, and has an ID of 5. The newform title of the task list will read "Test Entry | 5 ". So its title | ID. I then have a calculated column to take the right 3 characters of the title, so it prints out the ID.
    So pretty much I have a title and ID that match the form library...
    now the hard part.
    Say I have 10 tasks in the tast list related to ID # 5 from the form library.
    Is there a way to create a repeating table or other solution to show these 10 tasks within the form library form? I was thinking a button to query for data from a secondary source (task list) filter where ID = current Item ID. then have it set a fields value???
    Anyideas???

    Hi,
    Here's an idea. When you are creating the task, populate a ReferenceID field in the task list with the item ID of the form library list. In this form, create secondary data connection to the task list and include the fields that you want to show. Drag the
    group on the form, it will create repeated section with controls. Create a formatting rule on the section, condition where ID!=ReferenceID, Hide this section.
    This will display the repeating data from the Task list where ReferenceID is = ID and hide all others.
    Another variation would be to Filter the Data Connection itself and add the condition in the filter (ID=ReferenceID). Hope it helps.
    Regards, Kapil ***Please mark answer as Helpful or Answered after consideration***

  • Please read my question carefully, this is, I think, a question for the experts. It's not the usual name change question.   When I setup my new MacBook Pro, something slipped by me and my computer was named First-Lasts-MacBook-Pro (using my real first and

    Please read my question carefully, this is, I think, a question for the experts. It's not the usual name change question.
    When I setup my new MacBook Pro, something slipped by me and my computer was named First-Lasts-MacBook-Pro (using my real first and last name).
    I changed the computer name in Preferences/Sharing to a new name and Preferences/Accounts to just be Mike. I can right click on my account name, choose advanced, and see that everything looks right.
    However, If I do a scan of my network with my iPhone using the free version of IP Scanner, it lists my computer as First-Lasts-MacBook-Pro! And it lists the user as First-Last.
    So even though another Mac just sees my new computer name, and my home folder is Mike, somewhere in the system the original setup with my full name is still stored. And it's available on a network scan. So my full name might show up at a coffee shop.
    Can I fully change the name without doing a complete re-install of Lion and all my apps?

    One thought... you said the iPhone displayed your computer's old name? I think that you must have used the iPhone with this computer before you changed the name. So no one else's iPhone should display your full name unless that iPhone had previously connected to your Mac. For example, I did this exact same change, and I use the Keynote Remote app to connect with my MacBook Pro. It would no longer link with my MacBook Pro under the old name, and I found that I had to unlink and then create a new link under the new name. So the answer to your question is, there is nothing you need to do on the Mac, but rather the phone, and no other phone will display your full name.

  • ? for the experts regarding the HP Pavilion dv7t Quad Edition (with the new Sandy Bridge CPU's)

    Hello,
    This is a question for the experts.
    The HP Pavilion dv7t Quad Edition has the following GPU:
    1GB ATI Mobility Radeon(TM) HD 6570 graphics
    Is this GPU GDDR5 or DDR3 in this laptop?  I know someone that purchased one from a MicroCenter and it shows GDDR5 on the packaging (http://www.flickr.com/photos/bravoexo/5298674802/) and in GPU-Z, but I called HP support and they said it was DDR3 (although, HP support told me that GDDR5 didn't exist and that DDR3 in GPU's were the most advanced to this date).
    Please let me know ASAP, as this is a main factor in me purchasing this or not.  I can find other DDR3 gaming laptops out there for less, but if this really IS GDDR5, then I'm sold.

    Thank you both for your questions and answers, I was wondering the exact same thing. I'm ashamed to admit I already began the process of perchasing this computer prior to having all detailed specifications made available.
    I'm upgrading from a 13.3 inch HP laptop called the dv3510nr. It was never intended for enthuiast gaming, but it has exceeded the sum of its parts. It does have dedicated graphics, backlit keyboard, other novelties that make it the best computer I've personally ever owned.
    Few people can say they've managed to run Fallout 3 or Supreme Commander at maximum detail on a 9300M GS. It has 512 MB of DDR2 memory, 4 GB system memory and a 25W P7350 Core 2 Duo processor (2.0 GHz)
    Its served me well but mobility is no longer a priority. I waited until Sandy Bridge was announced and took the plunge immediately. 6 GB of DDR3 RAM, a 6570 with 1 GB, 1600 x 900 display AND best of all:
    -The i7-2720 quad core processor, (2.2 GHz, up to 3.3 GHz with Turbo Boost)
    --for a total price of just over $1,000 after taxes. With 2 year warranty standard.
    For brand new, bleeding edge technology not yet even widely available, at such a large upgrade margin at an absurdly low price; I didn't need to know anything else.
    So imagine my excitement when I learned this 6570 was in fact based on the old 5770 (the lowest available card with GDDR5 support), not the 5650; and could contain a 1 full GB of the fastest memory technology on the market, GDDR5.
    That would mean virtually no bottlenecks in my system as a whole; I don't have an SSD but truth is, I don't like them anyway. They don't last very long with 'wear leveling', cost too much and only impact synthetic benchmarks.
    My new DV7 can't get here fast enough.

  • For The Experts: Quick Look and Cover Flow?

    Hi
    I have not been able to find the answer to my question anywhere on the internet. I thought that some of you experts out there may be able to help me.
    I deal with thousands of files all the time that are essentially text files (i.e .txt). I have one problem though. They end with the extension .01 for Jan, .02 for Feb etc. If I rename the extension on one of these files to .txt, I can view them in Cover Flow and I can also see the contents by using Quick Look.
    Unfortunately, I cannot rename the extensions on all these files to .txt, because they need to be sent to various departments and cannot be changed.
    Does anyone know if it is possible to make Cover Flow and Quick Look think that these are text files?
    Thanks...
    Brian.

    Hello. SetFile, just like any other console tool, can accept wildcards. For example:
    Set the attribute of all files in the directory named mydocs:
    <pre>
    /Developer/Tools/SetFile -t TEXT /Users/whuggy/mydocs/*
    </pre>
    You can also use the more powerful 'find' command: Find all files in your 'mydocs' directory that ends with '.01' and set them as a text file:
    <pre>
    find /Users/whuggy/mydocs -name "*.01" -exec /Developer/Tools/SetFile -t TEXT {} ';'
    </pre>
    This means: find stuff inside mydocs directory whose name ends with ".01"; on each item you find execute the command /Developer/Tools/SetFile -t TEXT to it. The '{}' placeholder is substituted with the filepath of an item. And the ';' at the end designates the end of that command.

  • I have few questions to ask about the Expert Series and Valet Series

    Hello.
    I have few questions to ask about the Expert Series and Valet Series.
    1. I see there aren't any print server/bridge/access point for these two new series. Do I have to use previous ones? Or the new ones are in planned in near future?
    2. Do I "HAVE TO USE CONNECT SOFTWARE"?  Can I just use web interface to do every setting that these routers features?
    3. Does expert series routers support guest network and parental control?
    4. When I look into informations of these router, some router doesn't give information about backward compatible to older standards. Do I have to consider that as they are backward compatible with older standards?
    Ok, that's all for now.
    If I need to ask more questions I will do that in this thread as reply

    With the New Expert or the Valet Series Router, you still can use the Print Server / Bridge and Access Points.
    Well with the Expert and Valet Series router, you have an option to User Cisco Connect Software or you can User Web Interface of the Router. But with the Cisco Connect Software you have an Advantage of creating a Guest Account and using Parental Control , which is not available using the Web Interface.
    These both the routers are backward compatible and they can connect to your G Series Product.

  • After a quiz can you show the questions and answers for the user to review from passing the quiz

    After taking a quiz, is there a way to show the questions and answers for the user to review from passing the quiz.
    And the ones who has failed the quiz would be directed to the first slide again to take the quiz over.
    Thanks

    Rod
    I see that information about adding the review quiz button but on that last slide where it shows results, I want it jump back to slide 1 but it jumps to the first question of the slide. Is there a way around that?

  • New comer ask 2 simple questions:how to set the use of the right click of

    New comer ask 2 simple questions:how to set the use of the right click of your mouse?
    I don't know why when i click the right button of my mouse in logic, sometimes it's the same funcion as my left one, some times it's the same function that opens the tool menu....But in MacOSX,it's all okay.Just the weired thing in logic ,please help
    2.is there any kind of filter in Score? I mean, in midi track I have a C1 note, and I don't want the C1 note shown in my score, I want every note show which are above C2, like a filter. I think this is helpful dealling with some keyswich things,how can we do that?

    In Preferences -> Global -> Editing you can choose weather right click is assignable or opens the tools box.
    Not to sure about the score dude

  • Hello, my question is to forget the questions to buy in the store is there any way to recover it, because hey tried but there is only option to reset the password and no questions

    hello, my question is to forget the questions to buy in the store is there any way to recover it, because hey tried but there is only option to reset the password and no questions

    Didn't the link to contact the iTunes Store staff in the 'Additional Information' section of that article work for you? If you don't already have a valid rescue email address, only Apple itself can reset the questions.
    (90961)

  • With the new upgrade to iOS 7 for the iPhone, is there anyway to change the background on the calendar?

    With the new upgrade to iOS 7 for the iPhone, is there anyway to change the color background on the calendar? 

    There are, however, lots of calendar apps in the App Store. They will used th same data as th built in app and sync just the same way. Many of them are quite customizable or, at least have different backgrounds. Some that I like are Week Cal, Fantastical, Cal, Tempo.
    Best of luck.

  • For the ISO code there is no unique SAP currency code for ALE

    While entering in incomming invoice , we got this error message.
    "For the ISO code there is no unique SAP currency code for ALE" .Any idea what this error is related to ?
    Thanks
    SN

    Hi satya,
    Not sure if this might help ... check out this OSS note "Note 313772 - Performance problem in CURRENCY_CODE_SAP_TO_ISO"
    Regards
    Genie

  • I own a hitachi dz-hs300a and would like to download the videos on my hardrive to my imovies..i dont have the disc for the software, is there anywhere i can download it for macbook pro?

    i own a hitachi dz-hs300a and would like to download the videos on my hardrive to my imovies..i dont have the disc for the software, is there anywhere i can download it for macbook pro?

    Exactly what are you getting? A pic of the message would help.
    And no. I am not going to click on your link.

  • Where can I download OSX Maverick. I'm looking for the link where there is the "download button" I can't find it!

    Where can I download OSX Maverick? I'm looking for the link where there is the "download button" I can't find it! Please Help!

    What is your current operating system? It needs to be at least Snow Leopard 10.6.8 in order to have the App Store available.
    Which Mac are your trying to upgrade? It needs to be:
    iMac (Mid 2007 or newer)
    MacBook (Late 2008 Aluminum, or Early 2009 or newer)
    MacBook Pro (Mid/Late 2007 or newer)
    MacBook Air (Late 2008 or newer)
    Mac mini (Early 2009 or newer)
    Mac Pro (Early 2008 or newer)
    Xserve (Early 2009)

Maybe you are looking for

  • How do I move a file to the tones folder?

    I'm trying to create a ringtone.  The file extention is .m4r.  The file will not go in the tones folder.  I try to move it and I just get that symbol that's a red circle with a diagonal line through it.  I am using iTunes 10.5.2 and Windows 7 pro 64

  • Why is my iPod dead?? (Brand new iPod)

    Hi! I just bought a 60g Black iPod video, I took it out of the box, used it for about 3 hours then battery needed to be charged, so I plugged it up in my computer before going to sleep. Three hours after I plugged it, I checked on the screen and the

  • Mapping issue in Date Format

    Hi Experts, I have a mapping problem in my object. I have two filelds coming from the Control record of an IDoc CREDAT and CRETIM. Now, I need to concate them and put them in a target field DateandTimeCreated in the format: YYYYMMDDHHMMSS Is their an

  • Cannot open/edit previously saved forms

    I just upgraded my reader and now I cannot open/edit any of my forms previously saved.  I work in a law office so I can't re do all my forms.  How do I open and edit forms I previously saved?

  • Update query in procedure

    I have 2 tables aas below. create table main_data(id number,all_set_flag char(1),set_time timestamp) create table sub_data(id number,set_time timestamp); insert into main_data values(1,'',''); insert into main_data values(1,'',''); insert into main_d