char to int?

This is a discussion on char to int? within the Game Programming forums, part of the General Programming Boards category; I am working on a "HighScore" system for my game.... now.. the thing is.. I want to say Code: if(newscore ...

  1. #1
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200

    Question char to int?

    I am working on a "HighScore" system for my game.... now.. the thing is.. I want to say
    Code:
    if(newscore > oldscore)
    {
      update_score();
    }
    but newscore is an int and oldscore is a char, how can I change the char temporarily to an int? or is there a better way?
    What is C++?

  2. #2
    Registered User codingmaster's Avatar
    Join Date
    Sep 2002
    Posts
    309
    Code:
    if (newscore > ((int)oldscore))
    {
    update_score();
    }
    .
    .
    .
    
    .
    .

  3. #3
    Registered User codingmaster's Avatar
    Join Date
    Sep 2002
    Posts
    309
    Code:
    if (newscore > ((int)oldscore))
    {
    update_score();
    }
    .
    .
    .
    
    .
    .

  4. #4
    Registered User codingmaster's Avatar
    Join Date
    Sep 2002
    Posts
    309
    Code:
    if (newscore > ((int)oldscore))
    {
    update_score();
    }
    .
    .
    .
    
    .
    .

  5. #5
    Registered User codingmaster's Avatar
    Join Date
    Sep 2002
    Posts
    309
    Code:
    if (newscore > ((int)oldscore))
    {
    update_score();
    }
    .
    .
    .
    
    .
    .

  6. #6
    Registered User codingmaster's Avatar
    Join Date
    Sep 2002
    Posts
    309
    SORRY I DON'T KNOW WHY THERE ARE 4 POSTS?????

    CAN SOMEBODY MAYBE DELETE THEM?
    Last edited by codingmaster; 05-26-2003 at 01:20 PM.

  7. #7
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    Maybe you can use atoi().

    here:http://www.mkssoftware.com/docs/man3/atoi.3.asp

  8. #8
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Uhhh....codingmaster? You can stop now
    Do not make direct eye contact with me.

  9. #9
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    >>Uhhh....codingmaster? You can stop now

    Yes, please do.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  10. #10
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Originally posted by codingmaster
    SORRY I DON'T KNOW WHY THERE ARE 4 POSTS?????

    CAN SOMEBODY MAYBE DELETE THEM?
    Yes, you can. Click edit, then check the delete box and save your changes.

  11. #11
    Nor
    Nor is offline
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299
    please read the faq. most questions like this have been covered too many times to count
    http://faq.cprogramming.com/cgi-bin/...&id=1043284385

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 48
    Last Post: 09-26-2008, 04:45 AM
  2. can some one please tell me the cause of the error ?
    By broli86 in forum C Programming
    Replies: 8
    Last Post: 06-26-2008, 09:36 PM
  3. Replies: 14
    Last Post: 06-28-2006, 02:58 AM
  4. Game Won't Compile
    By jothesmo in forum C++ Programming
    Replies: 2
    Last Post: 04-01-2006, 04:24 PM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 02:27 PM

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