Results 1 to 3 of 3

Thread: Viewing items that are on a table and not in Edi (SQL)

  1. #1
    Join Date
    May 2008
    Posts
    35

    Viewing items that are on a table and not in Edi (SQL)

    My problem is that I want to do in a function C happens to me an integer less than 100 (ie two digits) to a string of two characters:

    23 -> 23
    5 -> 05

    And more that I try, do not know how to do it. The truth is it was never my strong handling strings with C. So happened to me one way but I have problems with the function and, of course, the handling of characters for the return value, you get part of my code to see if I put help or should I go for another forms.

    Code:
    char * pasarMinutos (int minutes) ( 
    
    char length [3]; / * declare string of three characters who will be the maximum * / 
    int first, second; 
    length [3] = '\ 0'; / * put the character string at the end of the last position * / 
    if (minutes> 9) / * if the digit is two numbers * / 
    ( 
    first = (int) (minutos/10); / * calculate the first number * / 
    if (first == 1) / * and since I'm going aki putting the first character according to the num * / 
    ( 
    LENGTH [1] = "1"; 
    ) 
    else if (first == 2) 
    ( 
    LENGTH [1] = "2"; 
    ) 
    ............................................... 
    else if (first == 9) 
    ( 
    LENGTH [1] = "9"; 
    ) 
    second = (min-first * 10); / * calculate the second num * / 
    if (second == 1) / * and the same thing with the first q * / 
    ( 
    LENGTH [2] = "1"; 
    ) 
    else if (second == 2) 
    ( 
    LENGTH [2] = "2"; 
    ) 
    ...................................... 
    ) 
    else if (second == 9) 
    ( 
    LENGTH [2] = "9"; 
    ) 
    ) 
    else / * if the number is only one-digit * / 
    ( 
    LENGTH [1] = "0" / * the first character will be a 0 * / 
    second = minutes; / * and from aki ago as in the previous * / 
    if (second == 1) 
    ( 
    LENGTH [2] = "1"; 
    ) 
    else if (second == 2) 
    ( 
    LENGTH [2] = "2"; 
    ) 
    .................................... 
    else if (second == 9) 
    ( 
    LENGTH [2] = "9"; 
    ) 
    
    ) 
    return length; 
    );

  2. #2
    Join Date
    May 2008
    Posts
    2,012
    I am new to this program but I think there's a function in stdlib.h that does that same item ()

    Anyway I have been bitten curiosity and I have been thinking about the algorithm. This is what I get:
    Code:
    itoa2 void (int num, char string []) ( 
    
    char aux ='0 '; 
    
    if (num == 0) ( 
    
    string [0] = '\ 0'; 
    ) 
    else ( 
    
    string [0] = (char) (aux + (num% 10)); 
    itoa2 (num / 10, & (string [1])); 
    ) 
    )
    What you think?

  3. #3
    Join Date
    May 2008
    Posts
    2,297
    I understand that what you want in this program here:

    Code:
    int result, value; 
    char characters [3] = ( "00 "};// this is only for you to put an end to the string 
    
    result = valor/10; 
    characters [0] = result +48 / / 48 is the decimal value of 0 in ascii, 30Hex 
    resulting value% = 10; 
    characters [1] = result +48 / / well as the values achieved in ascii

Similar Threads

  1. Replies: 5
    Last Post: 27-08-2011, 10:53 AM
  2. Replies: 3
    Last Post: 17-01-2011, 12:58 PM
  3. Link a Table to another Table to Drop Down In Main Table
    By himeshRES in forum Windows Software
    Replies: 6
    Last Post: 11-12-2010, 02:01 PM
  4. Replies: 4
    Last Post: 30-11-2010, 03:01 AM
  5. x200t multitouch screen viewing angles and portrait viewing
    By Mycenaen in forum Portable Devices
    Replies: 6
    Last Post: 17-09-2010, 06:34 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,093,577.94628 seconds with 17 queries