how would i..

Discussion in 'Programming General' started by SOFLYYO, Oct 14, 2012.

how would i..
  1. Unread #1 - Oct 14, 2012 at 4:26 AM
  2. SOFLYYO
    Joined:
    Nov 30, 2011
    Posts:
    154
    Referrals:
    0
    Sythe Gold:
    0

    SOFLYYO Active Member
    Banned

    how would i..

    go about getting user input and storing it into a char array?

    example:

    user enters in, "fdasfdsfsa fdsafsadf fdsafasfads" then "fdafsf fdsafasfasf fdasfasd"

    it prints out

    fdasfdsfsa fdsafsadf fdsafasfads

    fdafsf fdsafasfasf fdasfasd

    and it keeps looping while the user wants to do it? but at the same time storing the data in the array(s)
     
  3. Unread #2 - Oct 25, 2012 at 11:23 PM
  4. Raid500
    Joined:
    Feb 11, 2007
    Posts:
    592
    Referrals:
    1
    Sythe Gold:
    0

    Raid500 Forum Addict

    how would i..

    I don't get what data you want to store in arrays? If it keeps looping that text then the array will just have a bunch of that text stored... Unless you want to store the number of loops which you can just do with an integer. Clarify your question.
     
  5. Unread #3 - Nov 13, 2012 at 8:17 AM
  6. ladygaga
    Joined:
    Sep 14, 2012
    Posts:
    78
    Referrals:
    0
    Sythe Gold:
    0

    ladygaga Member
    Banned

    how would i..

    I would also like to know that , so please answer .
     
  7. Unread #4 - Nov 17, 2012 at 4:38 PM
  8. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    how would i..

    You wouldn't use arrays if you want it to be indefinite, you'd use vectors. Here's the basic logic (forgive me this is totally freehand):

    Code:
    vector<string> blah;
    bool quit;
    string temp;
    int counter = 0;
    
    while (quit == false)
    {
    cin >> temp;
    if (temp == "quit") return 0;
    cout << temp << endl;
    vector[counter] = temp;
    temp = "";
    counter++;
    }
     
< Assistance | Advanced Applet Embedding in .NET >

Users viewing this thread
1 guest


 
 
Adblock breaks this site