string to integer in pseudo

This is a discussion on string to integer in pseudo within the C Programming forums, part of the General Programming Boards category; how do i write the atoi() command in pseudo code???...

  1. #1
    kiz
    kiz is offline
    Registered User
    Join Date
    Sep 2007
    Posts
    25

    string to integer in pseudo

    how do i write the atoi() command in pseudo code???

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    you should ask the creator of the pseudo-code.
    Here is the C board, so we can only tell how to write the atoi in C
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    Registered User
    Join Date
    Sep 2007
    Posts
    104
    Something like this :
    Code:
    Convert String to Integer // Using atoi() in C for ex.

  4. #4
    Registered User
    Join Date
    Apr 2006
    Posts
    2,023
    Just explain how you would program such a function in English. List the steps in as much detail as you can. That's all pseudo code is really. Except you don't have to use complete sentences.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Different places have different definitions of pseudo-code, there is no formal standard for pseudo-code.

    The term pseudo-code itself means "false code", or more loosely, "not real code". It could be C with simplified syntax or it could be plain english (perhaps with simplified forms), or it could look like Pascal or Fortran (with a more flexible syntax).

    The idea with pseudo-code is that it holds fewer details than the actual code, but describes the solution to the problem in a way that is relatively easy to translate into a programming language.

    As to the answer to the original question,I think King Mir gave a good answer: Describe step by step the process of converting a string into an integer.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,682
    i would guess its just one line of code in C to convert an string to an int. The alternative to an atoi is to use sscanf(). ITs just a single statment. How would u think of to right a pesudo code for that. May be i would write it like this

    Code:
    Converted Integer value = atoi( String liternal which u wanted to be converted )
    I tired atleast

    ssharish

  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,489
    > how do i write the atoi() command in pseudo code???
    "You mean like multiply current result by 10 and add the next character (in a loop)" kinda thing?

    Depends how detailed you want your pseudo-code to be.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. String Class
    By BKurosawa in forum C++ Programming
    Replies: 117
    Last Post: 08-09-2007, 01:02 AM
  2. String issues
    By The_professor in forum C++ Programming
    Replies: 7
    Last Post: 06-12-2007, 09:11 AM
  3. Integer to string?
    By Blackroot in forum C++ Programming
    Replies: 2
    Last Post: 02-23-2006, 05:13 AM
  4. Another overloading "<<" problem
    By alphaoide in forum C++ Programming
    Replies: 18
    Last Post: 09-30-2003, 10:32 AM
  5. lvp string...
    By Magma in forum C++ Programming
    Replies: 4
    Last Post: 02-26-2003, 11:03 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21