Page 4 of 5 FirstFirst ... 2345 LastLast
Results 31 to 40 of 41
  1. #31

    very will said ChaosOrb... walay gamit kung dili gyud masabtan....


    i learned something with this discussion... naanad man gud mi sa C++.... ganahan ko mag learn sa C....


    nindot na daghan ta mahibaw-an....

  2. #32
    very will said ChaosOrb... walay gamit kung dili gyud masabtan....


    i learned something with this discussion... naanad man gud mi sa C++.... ganahan ko mag learn sa C....


    nindot na daghan ta mahibaw-an....

  3. #33
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    @ChaosOrb any new release version? hehehe...

  4. #34
    Quote Originally Posted by MarkCuering View Post
    @ChaosOrb any new release version? hehehe...
    huh? what new version?

  5. #35
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    on the program you post... there is much simplier I guess, using for loop and arrays only. there's an excellent technique or pattern to solve the problem...with a minimum coding.

  6. #36
    Quote Originally Posted by MarkCuering View Post
    on the program you post... there is much simplier I guess, using for loop and arrays only. there's an excellent technique or pattern to solve the problem...with a minimum coding.
    It's not needed na Mark, I guess the thread starter already submitted his/her assignment already. If you want a simpler solution, look at the code of silent-kill. It's relatively short and concise that uses loops and arrays.

  7. #37
    mga choi.... if mka sugat gani mo ug thread like this... mga assignment threads ba... be like silent-kill..... dont give him what he wants.... instead, make him get what he wants... d ta mu spoon feed oi... kay magka degrade nya ang mga future programmers diri sa pinas... hehehe... samot na karon na naa na'y .NET framework... magkatapolan na jud mga programmers ani... heheh...

    @silent-kill
    bai hold ur ground... sakto imo principle na d nmu i hatag ang precise and exact code....they have their own brains... let them use it... dont let them use ours....................... coz its not free... hahahahah....

  8. #38
    here is my code ic C.
    variables:
    int num;
    int tens; //these for your variable ranging ten.
    if (num>19 && <=99)
    {
    tens = num/10;
    num = num% 10;
    switch(tens)
    {
    case 2:
    {
    printf("Twenty");
    break;
    }
    case 3:
    {
    printf("Thirty");
    break;
    }
    case until 9 for ninety...
    }

    }


    int num,
    if(num>=1 && num <=19)
    {
    switch(num)
    {
    case 1:
    {
    printf("One");
    break;
    }
    case 2:
    {
    printf("Two");
    break;
    }

    .
    .
    .
    until case 19:

    }

    Kung imong padayuno imong input pataas. ipababaw lang ang code, example imong input >=20 up to 99

    kung padayunon pagyud nimo pataas ang imong input mag declare lang ka ug variable for
    hundreds,thousand, hundredthousand, million and soon, then change the division /number and modulo % as you can see in tens...

    hope this will help.... good luck.....

  9. #39
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    Here's my step by step formula...

    1. Make an array:

    char *ones[10] = {"", "one ","two ","three ","four ", "five ",
    "six ","seven ","eight ","nine "};

    for Tens do this: "ten ","eleven ","twelve ","thirteen ", "fourteen ", "fifteen ","sixteen ","seventeen ","eighteen ","nineteen "

    for twenties do this: "","","twenty ","thirty ","forty ", "fifty ","sixty ","seventy ","eighty ","ninety "

    for thousands or millions do this: "","thousand ","million ", "billion "......

    Note:
    put spaces at the end of the word, just leave the first index empty in "ones" and two index empty in "twenties". Glad if you figure it out why. Especially why we not included "Hundred" you can see sample output below.


    2. Convert the user input into string... I used sprintf functions. your goal on this level is to break the string by "3" if the user input 45,310. You should have two separated variable that holds "45" and "310". Think about another array this time.

    constMIN = 3 (of course we want to break every 3 digits)
    constMAX = maximum 0's in your program you can even make it until vigintillion if you want.

    Code:
    	for(i=constMIN; i<constMAX; i=i+constMIN){
    
    		len = strlen(strVal);
    		if ((len - i) < -2) break;
    		else if ((len - i) >= 0){
                               save something here...
    			}
    		}
    		else if ((len - i) >= -1){
    			do something here
    		}
    		else if ((len - i) >= -2){
    			do something here
    		}
    		else break;
    	}
    Just figure it out what the purpose of my conditional statement "-1" and "-2"

    3. String Manipulation. Just use a simple for loop. no need any switch or many if if if if if if if if else else statements.... take note what's inside of your array here. it can be integer or a character. at step 2. I directly converted the number back to integer.

    clue:


    a. User input was "254,310"
    b. We break this into two part {2,5,4} and {3,1,0}
    c. Using for loop..... this would be....


    Code:
    for loop ...where we read the number X
            var1 = x % 10
            var2 = .. 100 and 10 being use here.
            var3 = .. 1000 and 100 being use here.
            if (x == 0)  continue  # of course
    next on the code above are just plain if statements...

    Tens[2] + ones[5] + "hundred" + and so on.... you will only add the string "hundred" to a specific condition. where var3 is greater than 0.


    important output to analyze from my previous post:


    seven hundred ninety two
    seven hundred ninety four
    seven hundred ninety six
    seven hundred ninety eight
    eight hundred
    eight hundred two
    eight hundred four
    eight hundred six
    eight hundred eight
    eight hundred ten
    eight hundred twelve
    eight hundred fourteen
    eight hundred sixteen
    eight hundred eighteen
    eight hundred twenty
    eight hundred twenty two
    eight hundred twenty four
    eight hundred twenty six
    eight hundred twenty eight
    eight hundred thirty
    ..
    ..
    ..
    one thousand four hundred thirty six
    one thousand four hundred thirty eight
    one thousand four hundred forty
    one thousand four hundred forty two
    one thousand four hundred forty four
    one thousand four hundred forty six
    one thousand four hundred forty eight
    one thousand four hundred fifty
    one thousand four hundred fifty two
    one thousand four hundred fifty four
    one thousand four hundred fifty six
    one thousand four hundred fifty eight
    one thousand four hundred sixty
    one thousand four hundred sixty two

    knowledge needed or lessons gain!


    1. converting integer to string/char and vice versa.
    2. using ARRAY and how to manipulate its item thru for loops.
    3. Basic math operations such as % operator and division.
    4. Lessons! sometimes it is useful to visualize what is the output! and from that, create or determine any repeated routines whether you will be going to use array of strings or numbers using for loop or if statements to get the distinguished PATTERNS.
    5. Learn how to count by reading... yes... im not kidding. after reading the numbers by words instead of digits. You will get some clues....


    cheers...

  10. #40
    Elite Member
    Join Date
    Aug 2008
    Gender
    Male
    Posts
    1,422
    Blog Entries
    1
    problem solved

  11.    Advertisement

Page 4 of 5 FirstFirst ... 2345 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