Page 1 of 5 1234 ... LastLast
Results 1 to 10 of 41
  1. #1
    Elite Member
    Join Date
    Aug 2008
    Gender
    Male
    Posts
    1,422
    Blog Entries
    1

    Question help me...,c++ proram code


    A program that would accept a non-negative integer & display its word equivalent..

    example: you will input 1 the output will be the word "one"
    maximum number is 65535..minimum is 1...
    help me ASAP..

  2. #2
    hehehe

    first you need to store:

    array1 = one, two, three, four, five, six, seven, eight, nine, zero
    array2 = ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen,
    array3 = ten, twenty, thirty, fourty, fifty, sixty, eighty, ninety,
    array4 = hundred
    array5 = thousand

    thats all


    create a function for this called sux(string twodigitstring) {
    if your given 2 digit but lesser that 20 then:
    lookup array2 + kids(lastdigit);
    else if your given 2 digit and greaterthan 19 then:
    call teenagers(twodigitstring);
    return result;
    }

    create a function for this called teenagers(string twodigitstrings) {
    look up array3 + (if array1 = zero dont include)
    return result;
    }

    create a function called kids(string 1 digit) {
    lookup array1
    return result;
    }

    create a function called oldies(string threedigitstring) {
    kids(firstdigit) + sux(lasttwodigit);
    return result;
    }

    create a function called acient(string fourdigitstring) {
    kids(firstdigit) + array5 + oldies(last3digit);
    return result;
    }

    create a function called OMG(string fivedigitstring) {
    sux(first2digit) + acient(last3digit);
    return result;
    }

    if your given 1 digit then:
    call kids(value);
    if your given 2 digit then:
    call sux(value);

    if your given 3 digit then:
    call oldies(value);

    if your given 4 digit then:
    acient(value);

    if yor given 5 digit then:
    OMG(value);


    of course you need to check zero values and nullify them if needed
    Last edited by silent-kill; 08-30-2008 at 03:34 AM.

  3. #3
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    assignment? ^^

  4. #4
    silent-kill

    the idea of urs is great but the question would be... what if they are going to make just a simple programming for that problem?


    =)


    what man inyo dapat gamiton ana BORDOGOY?

    if else statement or Select case?


    kailangan na makaarray or not?

  5. #5
    sayon ra mani....pero this is another assignment thread!

    kung akong ning answeran, pila man hatag nmo bordogoy? huh?

    Maayo nang paninglan ang ga.post ug assignment ngari para dili mag.anad! Pagka.tapulan nlng jud sa mga student or today's generation.

    madala ra man intawn na sa select/if then else oie... tsk tsk tsk..


    beh beh beh...pila man hatag nmo? P500.00??

  6. #6
    if we keep saying its easy and not really helping out thats a total waste of 'our' precious time replying something that doesnt even come close to solving a problem.... at least point him to the right direction

    madala ni switch satement and if pro mas choi kong functions i dont see how you implement this without an array... or your gonna have 65535 switch statement lol.

    goodluck and try to be creative!

  7. #7
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    and where's bordogoy now that's why I hate replying with 1 post to 1 assignment ^^

  8. #8
    Quote Originally Posted by silent-kill View Post
    if we keep saying its easy and not really helping out thats a total waste of 'our' precious time replying something that doesnt even come close to solving a problem.... at least point him to the right direction
    oh?...you should have given the correct answer then para wala na mi nag.usik ug time pag.reply to this thread.

    for goodness sakes, tan.awa gud ng thread starter, 1 post? Klaro kaayo nga student and in desperate need freebies to get good grades, but does he learn something from it? Naa cya makat.unan kung ma.pass na ang assignment? I don't think so, kung tarong pa na nga student, gi.post na unta niya ang iyang code ngari sa thread if ever naa na cya gibuhat.

    Quote Originally Posted by silent-kill View Post
    madala ni switch satement and if pro mas choi kong functions i dont see how you implement this without an array... or your gonna have 65535 switch statement lol.
    wow, how dumb would you be, if maabot uf 65K+ ang imong switch statement. You're too dependent to data structures if you use array, and yes, it can be achieved without using functions, medyo taas2x lng jud hinoon.

    just to give silent-kill the satisfaction of pointing to the right direction.

    this is how I solve it"
    -get input
    -divide your input to extract ones, tens, hundreds and thousands.
    -use switch/if then else to
    -ones, tens, hundreds, and thousands
    -and convert them to string equivalent.
    -concatenate each string
    -output concatenated string

    in this program, you might be using at least 6-8 group of switch/if then else depending on how you implement it.

    you don't have to be a smart-ass to convert that to actual code. And I don't give direct answer to help lazy people who are not helping themselves. To the thread starter, enjoy converting that to C++ code, and when you do, kindly post it here so that we can make nessary correction.

  9. #9
    Elite Member
    Join Date
    Aug 2008
    Gender
    Male
    Posts
    1,422
    Blog Entries
    1
    dli man sad saigon nga dependent ko..newbie pa man sad ko.. 1st year,,wala man mi gisampolan ug ing ana sa among maestro,iya man na gilargo ug hatag..
    help me pliss mga bro..

  10. #10
    Elite Member
    Join Date
    Aug 2008
    Gender
    Male
    Posts
    1,422
    Blog Entries
    1
    you can use if else or switch case...

  11.    Advertisement

Page 1 of 5 1234 ... LastLast

Similar Threads

 
  1. help me..!!!
    By hot_chick in forum "Love is..."
    Replies: 53
    Last Post: 07-13-2011, 03:21 PM
  2. Replies: 4
    Last Post: 12-26-2007, 02:03 PM
  3. Help me pangita sa PORK Barrel gihatag sa Goberno ngadtu....
    By dmcebu in forum Politics & Current Events
    Replies: 12
    Last Post: 06-06-2006, 02:02 PM
  4. Help Me I Cant Log In
    By mark eugene in forum Support Center
    Replies: 12
    Last Post: 06-06-2005, 02:35 PM
  5. hey help me
    By roselyn in forum Support Center
    Replies: 2
    Last Post: 04-23-2005, 04:59 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top