Thread: char/int help

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    1

    char/int help

    I'm fairly new to C++ and am making a small calculator just to get the hang of things.
    I was wondering how to send an errror message when someone enters a letter instead of a number.
    E.G When it says "enter your first number here:" and you enter "g" it sends an error.
    I know how to send the message but I dont know how to do the other bit.

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Read as a string and (attempt to) convert.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Is there any way to prevent a char/int infinite loop?
    By Tokimasa in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2004, 10:14 AM
  2. Char/Int problems.....
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 05-19-2002, 02:54 AM