CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2011
    Posts
    3

    Help writing a code. Please!!!

    Ok I'm writing a code because the girl I'm going to ask out is very much a closet computer programmer. I, however, am C++ inept. I guess she uses microsoft visual studio mainly. I wanted to write a code asking her out. I know this is a bit cheesy, and not something you see on these boards everyday. So have a laugh at my cheesyness, and please help me out. I need to make this work!

    Here was one that was previously written for me, but my friend said it didnt work.
    #include <iostream>
    int main()
    {
    char letters[] = " beilmnouwy";
    int order[] = { 9, 3, 4, 4, 0, 10, 7, 8, 0, 1, 2, 0, 5, 3, 6, 2 };

    for(int i = 0;i < sizeof(order) / sizeof(*order);++i)
    std::cout << letters[order[i]];
    std::cout << std::endl;

    return 0;
    }


    I guess its a word scramble of some sort. I'm sorry I'm so lost when it comes to this. Any ideas new or added to this are appreciated.

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Help writing a code. Please!!!

    As far as I can see it should work (if the order is as it should be). What issues do you experience?
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  3. #3
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: Help writing a code. Please!!!

    Quote Originally Posted by Vanek26goal View Post
    [...] but my friend said it didnt work.
    Maybe he didn't mean that in a technical sense?

    The code definitely does compile on VC++ 2010 and when run outputs a valid english sentence.

    Ah, and... Welcome to CodeGuru!

    ... and good luck, anyway...
    Last edited by Eri523; April 25th, 2011 at 06:25 AM.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  4. #4
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Help writing a code. Please!!!

    We got the message.
    Presume that your firend wants to see if you can get it as well, withouth the others help.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  5. #5
    Join Date
    Apr 2011
    Posts
    3

    Re: Help writing a code. Please!!!

    Can I ask what it spits out? And could someone add the name Kelsey into it?

  6. #6
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Help writing a code. Please!!!

    You're not putting much effort into this. Are you sure this is the girl you want?
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  7. #7
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Help writing a code. Please!!!

    I can bet she's a gorgeous computer science teacher...
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  8. #8
    Join Date
    Apr 2011
    Posts
    3

    Re: Help writing a code. Please!!!

    I taught myself some basic C++ skills. I think she will appreciate, though basic, that I put the time in to learn it myself. Thanks everyone for the help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured