Multiple Word Strings Using C++ in Xcode 2.2

This is my first post and I'm happily a new member and hopefully a helpful one as well. I took a C++ programming class in school, decided to use Xcode and start doing programming again. However, I have this issue:
I'm trying to use a string to read me what I've entered for the name of a person, of course once there is a space, the name ends. Here is my code...
int main()
int loannumber;
string name;
cout << "May I have your loan number please? ";
cin >> loannumber;
cout << "Your loan number is " << loannumber << endl;
cout << "May I have your name please? ";
cin >> name;
getline (cin, name);
cout << "Hello " << name << ".\n";
Whenever it asks me for the name, I put the first and last name and it will only read the last name back to me.
How can I get multiple word strings in C++ code? Can someone help me?
Thank you!!

Hi--
Welcome to the Apple Discussions.
You can do it if you rewrite your code something like this:
#include <iostream>
using namespace std;
int main (int argc, char * const argv[]) {
char ca[100];
cout << "May I have your name please?\n";
cin.getline(ca, 100);
cout << "Hello " << ca << ".\n";
return 0;
}I got this tip from this page, which I found with a Google search. I really don't use C++, though, so I'm not exactly certain that's the "correct" way to go about doing this...
charlie

Similar Messages

  • Package search for multiple word string?

    Ok, im feeling really dumb, but how do I search for packages using multiple words in a single string?  For example if I do the command "pacman -Ss session manager" it will return a huge list of all packages with the word session and all packages with the word manager, but what i really want to see is the smaller list of only the packages that contain the entire exact string session manager.

    For me yaourt does the trick if you use ezzetabi's example ('session.*manager'). However, for 'session manager' only it doesn't.
    You could try packer (in AUR). I just tried all three of them and packer seems to also look for the two words together only if you use '... ...' only.

  • How to Capture Multiple Line String using Regular Expression?

    Hi, 
    I have a simple program like this:
    What I want to accomplish is to capture everything between >>start and >>end using a single Match Regular Expression node. It seems that setting multiple? to True or False does not help.
    I am using LabVIEW 2012.
    If it is impossible to capture it using a single node, that is fine. But I want to make sure that I can make full use of this node without combining serveral others.
    Thank you!
    TailOfGon
    Certified LabVIEW Architect 2013
    Solved!
    Go to Solution.

    Thank you for the fast response! Your solution worked in the example case
    After I saw your post, I was finally able to step forward. But I still wanted to make use of dot notation due to the limitation of characters that match with \w. 
    I made some more modification to your regular expression then now it seems working for all characters:
    >>start((?:\s|.)*)>>end
    Thanks!
    TailOfGon
    Certified LabVIEW Architect 2013

  • Multiple Word Search

    Does anyone know how i can search a coloumn using multiple words without using string tokenizer I get all the values in the table everytime as it searches using " " unless you enter a string in every section. If you just want to search for one word it still displays every value in the table. The code is below
    try {
    StringTokenizer searchtoken = new StringTokenizer(searchwords,",");
    String s1 = searchtoken.nextToken();
    String s2 = searchtoken.nextToken();
    String s3 = searchtoken.nextToken();
    String s4 = searchtoken.nextToken();
    String s5 = searchtoken.nextToken();
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn = DriverManager.getConnection(
    data, "", "");
    Statement st = conn.createStatement();
    searchwords = searcharea.getText();
    ResultSet rec = st.executeQuery(
    "SELECT * "+
    "FROM data "+
    "WHERE Annotation LIKE '%"+
    s1+
    "%' OR" +
    " Annotation LIKE '%" +
    s2 +
    "%'OR"+
    " Annotation LIKE '%" +
    s3 +
    "%'OR" +
    " Annotation LIKE '%" +
    s4 +
    "%'OR" +
    " Annotation LIKE '%" +
    s5 +
    while(rec.next()) {
    //System.out.println(rec.getString("Location"));
    searchBox.addItem(
    rec.getString("Location") + " " +
    rec.getString("Start_Time") + " " +
    rec.getString("End_Time") + " " +
    (rec.getString("Annotation")).toUpperCase()
    st.close();
    } catch (Exception e) {
    JOptionPane.showMessageDialog(frame, "The search criteria entered is not in correct format");
    } catch (Exception e) {
    JOptionPane.showMessageDialog(frame, "The search criteria entered is not in correct format");
    }

    Does anyone know how i can search a coloumn using
    multiple words without using string tokenizer I get
    all the values in the table everytime as it searches
    using " " unless you enter a string in every section.
    If you just want to search for one word it still
    displays every value in the table. That is how databases work.
    If you don't want to search on a field then you must not include it in the clause.

  • Highlight multiple words in column formatting

    Hi,
    it should be possible to highlight multiple words by using a comma delimited list, but only the first item in the list is highlighted. It this a bug?
    Thanks, Maren

    Hello,
    I have the same problem. Did you find any workaround or something?
    Thanks,
    Andrei

  • How to use multiple VCI strings for lap 1300 and 1200 (option 60) in one pool?

    Hi All,
    Hope to you a very happy new year,
    I have two differnt LAP 1300 and 1200 in my network and I need to add theme to the WLC,
    I successed to add one of theme by the option 60 in the DHCP pool at the Core SW,
    So my quetion is below:
    How to use multiple VCI strings for lap 1300 and 1200 (option 60) in one pool?
    Thanks in Advanced,
    Ahmed,

    To add to Scott's post.  Option 60 would be useful if you needed to put certain types of AP on specific controllers.  Otherwise, no real need to use it for the most part.
    Though, I do recall an issue a few years ago that some windows machines had issues getting DHCP if option 43 is being returned.
    Now, on an IOS switch, you can only configure one option 60 per DHCP scope
    HTH,
    Steve
    Please remember to rate useful posts, and mark questions as answered

  • How to pass multiple query string values using the same parameter in Query String (URL) Filter Web Part

    Hi,
    I want to pass multiple query string values using the same parameter in Query String (URL) Filter Web Part like mentioned below:
    http://server/pages/Default.aspx?Title=Arup&Title=Ratan
    But it always return those items whose "Title" value is "Arup". It is not returned any items whose "Title" is "Ratan".
    I have followed the
    http://office.microsoft.com/en-us/sharepointserver/HA102509991033.aspx#1
    Please suggest me.
    Thanks | Arup
    THanks! Arup R(MCTS)
    SucCeSS DoEs NOT MatTer.

    Hi DH, sorry for not being clear.
    It works when I create the connection from that web part that you want to be connected with the Query String Filter Web part. So let's say you created a web part page. Then you could connect a parameterized Excel Workbook to an Excel Web Access Web Part
    (or a Performance Point Dashboard etc.) and you insert it into your page and add
    a Query String Filter Web Part . Then you can connect them by editing the Query String Filter Web Part but also by editing the Excel Web Access Web Part. And only when I created from the latter it worked
    with multiple values for one parameter. If you have any more questions let me know. See you, Ingo

  • Can I covert multiple Word Documents into a single PDF using Acrobat Pro

    I'm using Acrobat Pro X version 10.1.10...I'm trying to select multiple Word Document files  (Mac Version 14.4.3) but when choosing the files, Word Documents I cannot select them as a convertible file format. If I drag them into the conversion box it says they are not a recognised file format....any ideas?

    Can you open any WORD file in Acrobat? If not, it is likely a limitation of Acrobat on the MAC. On the PC, you can simply use the Combine option in the file menu to create a new PDF. The conversion of the WORD document uses the PDF Maker option installed in WORD that must work, but this is the same process as opening a DOC or DOCX file directly in Acrobat. There are limitation with the compatibility of various versions of OFFICE and Acrobat that could be another issue you are having, but I don't know the combinations for a MAC. This only gives you some thoughts to consider. Some of the MAC users may be by later to give further thoughts.
    The alternative is to create a PDF for each of the WORD files and then use the combine feature to combine the PDFs.

  • Using a multiple word choice in a dropdown field to fire a java script

    I'm a complete beginner to java script, and relatively new to form building in Acrobat.
    I'm using a dropdown field to auto-fill other fields based on my 1st dropdown selection.
    The 1st dropdown field allows me to select a variety of vendors.  Once I select the vendor, it auto-fills the contact info for that vendor.
    I plagiarized the scripting from this link: https://acrobatusers.com/tutorials/change_another_field.  I even changed my field names for the time being.  I'll change my form field names back and the script to match once I have it working the way I want.
    If I use a single name in my vendor dropdown (1st field), the script works perfectly and auto-fills the contact information as expected.  However, many of my vendors are two or more words...and I need these full names to print out, so I cant just make a one word contraction.  Here's the script as I'm using it:
    Here's an example of a single word vendor name that works as expected:
    // Place all prepopulation data into a single data structure
    var DeptData = { ADLEMI:{ contact: "P.O. BOX 2371",
                                  email: "DOWNEY, CA  90242",
                                  deptnum: "PHONE: (562) 923-0333  FAX: (562) 923-8111" }};
    function SetFieldValues(cDeptName)
      this.getField("DeptContact").value = DeptData[cDeptName].contact;
      this.getField("DeptEmail").value = DeptData[cDeptName].email;
      this.getField("DeptNumber").value = DeptData[cDeptName].deptnum;
    The single vendor name I used in the example above is 'ADLEMI.'  If I add 'BEST' to ADLEMI (see below) I receive a syntax error.  I really need to be able to use multiple words in my Vendor dropdown to trigger the auto-fill.
    // Place all prepopulation data into a single data structure
    var DeptData = { ADLEMI BEST:{ contact: "P.O. BOX 2371",
                                  email: "DOWNEY, CA  90242",
                                  deptnum: "PHONE: (562) 923-0333  FAX: (562) 923-8111" }};
    function SetFieldValues(cDeptName)
      this.getField("DeptContact").value = DeptData[cDeptName].contact;
      this.getField("DeptEmail").value = DeptData[cDeptName].email;
      this.getField("DeptNumber").value = DeptData[cDeptName].deptnum;
    The only difference is I added a space and the word 'BEST' after ADLEMI.  Is there a way around this.  I need to have multiple words in my dropdown, or at least the full name of the vendor showing in the field when I print it out.
    Thanks

    Place double-quotes around the item name.
    On Mon, Apr 13, 2015 at 5:29 PM, bpwhistler <[email protected]>

  • How do you select multiple words using a Magic Trackpad?

    I know how to select multiple words with my mouse, but cannot figure out how to do it using my new Magic Trackpad. Here's the deal:
    Let's say you want to select "cannot figure out how to" in the sentence above. With my mouse, I'd place the cursor somewhere over the word "cannot," double-left-click and keep holding the button down. Then, dragging to the right, it would select each word in its entirety as I moved along the sentence. I do this all the time since it is a very quick way to select text.
    Okay, so how do you do this with the Magic Trackpad?
    I try a similar behavior, but it doesn't work. If I double-tap on "cannot," for example, one of two things happens. Either only the word "cannot" is highlighted and dragging does nothing to highlight more text. Or, if I'm quicker with the drag (aka swipe) right, it will select one character at a time starting from the cursor position when I double-tapped and not entire words, as I want.
    I'm stumped. Anyone?

    Jeffrey,
    The only good way seems to be by using the physical click on the Trackpad. Double physical click then drag. Much the way it's done on the mouse.
    Regards
    Captfred

  • 10G-form: How to do MULTIPLE WORD OR SINGLE WORD SEARCH at ITEM?

    I am using 10G DB + 10G Form Builder.
    I've 'database_item' where I am storing multiline text data.
    I want to do MULTIPLE WORD OR SINGLE WORD SEARCH at this item through FORM.
    I've tried by creating the following NON Database Items on the form:
    - multiline_search_text_item, and
    - multiline_result__text_item
    And then writing execute_query in KEY-NEXT-ITEM trigger.
    I've also tried using this in the POST-TEXT-ITEM at multiline_search_text_item:
    select table.database_item into :multiline_result__text_item from table where multiline_search_text_item = :multiline_search_text_item;
    Pl help me asap.
    Gaurav

    What you want to do is not clear.
    The query you wrote will select records where the table contains exactly what has been written in the search item. You can use LIKE and a wildcard search to find records which contain the search text:
    select table.database_item into :multiline_result__text_item
    from table
    where multiline_search_text_item LIKE '%'||:multiline_search_text_item||'%';
    You can use UPPER to make this case insensitive:
    select table.database_item into :multiline_result__text_item
    from table
    where Upper(multiline_search_text_item) LIKE Upper('%'||:multiline_search_text_item||'%');
    But I suspect you want either to match the individual words in the search text to individual words in the database multiline field, or find records where the search words appear (not necessarily as whole words). In that case, check out the following:
    -- set up a table (multiline and various whitespaces)
    DROP TABLE t;
    CREATE TABLE t AS
    SELECT
      ROWNUM rn,
      owner||Chr(9)||object_name||Chr(160)||subobject_name||'    '||object_id||' '||
      data_object_id||Chr(10)||object_type||' '||created||' '||last_ddl_time||' '||
      timestamp||' '||status||' '||temporary||' '||generated||' '||secondary AS col
    FROM all_objects;
    -- check the format of the multiline text item (col)
    SELECT * FROM t WHERE ROWNUM < 4;
    -- a type for the function below
    CREATE TYPE string_tab AS TABLE OF VARCHAR2(255);
    -- this function takes a string and cuts out each word, idetifying words
    -- as being separated by any whitespace.  it returns a collection
    CREATE OR REPLACE FUNCTION string_to_tab(
      p_string IN VARCHAR2) RETURN string_tab IS
      l_string LONG DEFAULT
        RTrim(regexp_replace(p_string,'[[:space:]]+',' ')) || ' ';
      l_data string_tab := string_tab();
      n NUMBER;
    BEGIN
      LOOP
        EXIT WHEN l_string IS NULL;
        n := InStr(l_string, ' ');
        l_data.extend;
        l_data(l_data.Count) := LTrim(RTrim(SubStr(l_string, 1, n - 1)));
        l_string := SubStr(l_string, n + 1);
      END LOOP;
      RETURN l_data;
    END string_to_tab;
    -- selecting from t where ANY of the words in the search text has
    -- a match in the multiline field (as a word or part of a word), so SYS
    -- matches to MDSYS and SYSTEM
    SELECT DISTINCT
      t.rn, t.col
    FROM
      t,
      (SELECT column_value
       FROM TABLE(CAST(string_to_tab('SYS   INDEX') AS string_tab))) x
    WHERE InStr(t.col,x.column_value) > 0;
    -- selecting from t where ALL of the words in the search text has
    -- a match in the multiline field (as a word or part of a word), so SYS
    -- matches to MDSYS and SYSTEM
    SELECT rn, col FROM(
    SELECT
      t.rn, t.col, cnt_x, Count(*) cnt
    FROM
      t,
      (SELECT column_value , Count(1) over(PARTITION BY 1)cnt_x
       FROM TABLE(CAST(string_to_tab('SYS   INDEX') AS string_tab))) x
    WHERE InStr(t.col,x.column_value) > 0
    GROUP BY t.rn, t.col, cnt_x
    WHERE cnt = cnt_x;
    -- selecting from t where ANY of the words in the search text
    -- match a word in the multiline field, so SYS matches only to SYS
    SELECT DISTINCT
      t.rn, t.col
    FROM
      t,
      (TABLE(CAST(string_to_tab(t.col) AS string_tab))) t2,
      (SELECT column_value
       FROM TABLE(CAST(string_to_tab('SYS   INDEX') AS string_tab))) x
    WHERE t2.column_value = x.column_value;
    -- selecting from t where ALL of the words in the search text
    -- match a word in the multiline field, so SYS matches only to SYS
    SELECT rn, col FROM(
    SELECT
      t.rn, t.col, cnt_x, Count(*) cnt
    FROM
      t,
      (TABLE(CAST(string_to_tab(t.col) AS string_tab))) t2,
      (SELECT column_value , Count(1) over(PARTITION BY 1)cnt_x
       FROM TABLE(CAST(string_to_tab('SYS   INDEX') AS string_tab))) x
    WHERE t2.column_value = x.column_value
    GROUP BY t.rn, t.col, cnt_x
    WHERE cnt = cnt_x;For your application you would replace 'SYS INDEX' with a variable (the search field). You can use upper() and wildcards for case insensitive & 'fuzzy' searches. You might need to modify the function so it removes other delimiters such as commas and colons.

  • GridView Sorting with multiple word in header

    Dear All
    we have dynamic GridView. we want to sort the gridview. we have multiple words in the header column like (Chicken Burger, Small Pizza , Chicken Roll etc). i m using below code but its giving me error on clicking header (Chicken Burger) like
    Cannot find column Chicken Inserts.
     protected void gv_SearchResults_Sorting(object sender, GridViewSortEventArgs e)
                 string Search= "SearchAllFOs";
            DataTable dtbl = ShowAllItemsData(SearchAllFOs);
            gv_SearchResults.DataSource = dtbl;
            gv_SearchResults.DataBind();
            if (ViewState["Sort Order"] == null)
                dtbl.DefaultView.Sort = e.SortExpression + " DESC";
                gv_SearchResults.DataSource = dtbl;
                gv_SearchResults.DataBind();
                ViewState["Sort Order"] = "DESC";
            else
                dtbl.DefaultView.Sort = e.SortExpression + "" + " ASC";
                gv_SearchResults.DataSource = dtbl;
                gv_SearchResults.DataBind();
                ViewState["Sort Order"] = null;
    Thanks and Best Regards Umair

    Hello Muhammad Umair 2756,
    Since we saw this GridViewSortEventArgs  https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridviewsorteventargs(v=vs.110).aspx
    Your project is actually a web project and please follow CoolDadTx's suggestion to post on ASP.NET forum.
    Best regards,
    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Multiple words don't work in search field

    When I enter multiple keywords in any search field nothing shows up.
    Let's say I'm looking for pink flowers. If I enter 'flowers' I see all my flower shots, as soon as I enter a comma, all photos disappear. If I go ahead and add 'pink', I still don't see anything. This happens in any search field whether in the browser or within a HUD.
    If I use a HUD, add text fields and enter 'flowers' and 'pink', think I see pink flowers. If I use the keyword checklist in the HUD, I see pink flowers. But I can never use multiple words separated by commas.
    What's wrong? I've checked the Aperture Manual and can't figure out why the multiple word method doesn't work.

    I always use the keyword search panel in the HUD when I am looking for keyworded images...multiples work fine there. I suspect the "text" search field is parsed EXACTLY as it says, examining a string and looking for a match anywhere in the metadata. My suspicion is that the comma is being parsed as JUST THAT, a comma, rather than a search field separator.
    My 2¢
    cheers,
    david

  • Search for multiple words in a field?

    is there a way to search for multiple words in a field? for example, if i have a metadata field called NOTES that contains the string "Joe and Bob created this version on Sunday" is there a way to search for "Sunday, Joe, Bob" and have it return the asset?

    Search using the "Matches Word" option instead of "Contains". That will limit your results to only assets that have a field value that includes all three of those terms. If they are not all included in the same field value, it will not return a hit. So if "Sunday" were in Keywords and "Joe" & "Bob" are in Notes, you would not get a hit for that search with "Matches Word".
    "Contains" searches for the contiguous string in any field on the assets.
    Further, if you add your Notes field to the Metadata Group "Asset Filter", it will appear in your advanced search options, asset subscription filters, and search expired responses. Then you can specifically limit the search to that field and choose from "Matches Word', "Contains", and several other search filters. Note that when you use "Matches Word" this way, you need to eliminate spaces from your comma delimited list of words or you will not get the search hits you want.

  • Searching multiple words within page separately

    1. I am searching within a page using the Find function.
    2. When I type in a search word, Find accurately highlights the word.
    3. I am trying to search multiple words at once, and have Find highlight them separately.
    E.g. Search for "motor OR cables" would search for "motor" and "cables" and not "motor cables" i.e. the search string has to be truncated to allow for each word to be searched separately.

    Hello,
    You can use the following Add-on and let me know if It helped your cause:
    https://addons.mozilla.org/en-US/firefox/addon/searchwp/
    If it did not help you,please get back to me. I will try to help you again.

Maybe you are looking for

  • Issue in PDF output for xml report

    Hi, I developed one template in RTF and output in pdf is looks fine. I have issue in the output, For some invoices i have more lines,when the line details comes to next page for the same invoice i can able to view only the lines information in the ne

  • How can I rearrange songs within an album in the main library?

    I have a book on tape that keeps loading out of order. I want to make each chapter a a separate album. Everything works but I can't get the tracks to load in order. Using a playlist would allow me to rearrange but then I can't divide it up into album

  • AIR installation on Windows XP

    I am having trouble installing AIR on my PC after downloading from the Adboe website.  When I run the installer, I get the message: "An error occurred while installing Adobe AIR. Installation may not be allowed by your administrator. Please contact y

  • How to use existing Key figure strecture ??

    Guys, I am creating a new query from the existing query on the same Multi provider. So, i created a copy of the query using RSZC and gave a new technical name. But the problem is both the query has the same Key figure strecture. and i have to modify

  • Maximum HD installation in G4 450 Dual (Gigabit)

    Is it possible to install more than 1 extra internal HD in the G4 450 Dual (Gigabit ethernet) model? I already have a 40 GB internal ATA drive installed, in addition to the main HD that came with the computer. I would like to install another 300 GB i