Thread: I really need some help here

  1. #16
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by ಠ_ಠ View Post
    EDIT: unless you mean "...keep track if you've read an even or odd number of times..."
    Yep.


    Quzah.
    Hope is the first step on the road to disappointment.

  2. #17
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    Quote Originally Posted by quzah View Post
    Yep.


    Quzah.
    Then what you said would be best, I tried reading it in as a formatted integer (%2d) but the EOF flag is vital in this case


    Edit:
    Unless you're guaranteed a certain number of numbers, then the problem becomes much easier

    edit2:
    examples 2 and 3 seem to kill that possibility
    Last edited by ಠ_ಠ; 07-06-2009 at 04:39 PM.
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  3. #18
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    Quote Originally Posted by newbie1973 View Post
    I've tried this

    Code:
    long integer l = getlongnumber()
    while (l >= 10) {
    print ascii(l % 100)
    l /= 100;
    }
    and for right to left (using recursion for fun)
    
    print_ascii_code(getlonginteger())
    
    print_ascii_code(long integer l)
    if (l >= 10) {
    print_ascii_code(l / 100)
    print ascii(l % 100)
    }
    can't get it to work
    Ok. Why dont you get it converted to C code. Just input a long unsigned integer from the user using scanf. Then make a while loop and do what you're doing in the colored line(taking the last two digits using % operator and obtaining the remianing number using / operator). For printing the ASCII code you dont have to make a separate function just use %c format specifier in your printf statement. And also do include the condition when the number becomes zero.
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  4. #19
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by BEN10 View Post
    Ok. Why dont you get it converted to C code. Just input a long unsigned integer from the user using scanf.
    I hope you don't want anything bigger than a four letter word.


    Quzah.
    Hope is the first step on the road to disappointment.

  5. #20
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    Quote Originally Posted by quzah View Post
    I hope you don't want anything bigger than a four letter word.


    Quzah.
    This is what the question says
    Take an unsigned long variable, ask the user for input.
    That's why I said to input a long unsigned integer.
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  6. #21
    Registered User slingerland3g's Avatar
    Join Date
    Jan 2008
    Location
    Seattle
    Posts
    603
    Quote Originally Posted by quzah View Post
    I hope you don't want anything bigger than a four letter word.


    Quzah.

    Yes indeed, that is why going the route of using a string to store user input would be recommended here. Then this "exercise" would prove to be more useful and I guess we are only dealing with capital letters and no other ASCII characters?

Popular pages Recent additions subscribe to a feed