![]() |
|
#1
|
|||
|
|||
If "x" isn't a number...?How can the program understand the variable is a number or a char?
|
|||
|
#2
|
|||
|
|||
Re: If "x" isn't a number...?Quote:
What is the difference between a number and a char in C/C++? :davis: |
|
#3
|
|||
|
|||
Re: If "x" isn't a number...?Quote:
I didn't undertand it. My problem is I want user to input a number, but if user input a char, my program is fail. I want program understood x is a char and warn user. |
|
#4
|
|||
|
|||
Re: If "x" isn't a number...?Quote:
What are the possible integral values for a signed char? -128 to 127? Aren't those "numbers?" Do you have something against those particular numbers? Was there a specific number that you were looking for that can not be represented by -128 to 127? Here's a good plan...go read the www.gidforums.com and then come back, post some of your "program" code so that we can figure out what the problem is without all of the ambiguous questions between here and there. :davis: |
|
#5
|
|||
|
|||
...Thanks davis, i put here my code. Sorry, i am new on forum.
Here is my code: CPP / C++ / C Code:
|
|
#6
|
|||
|
|||
Re: If "x" isn't a number...?Program failing in line 72. I wrote the means... If user wrote a char in question at line 72...
|
|
#7
|
|||
|
|||
Re: If "x" isn't a number...?CPP / C++ / C Code:
So, what is the value of tahmin after the user inputs a char? ...once you know what happens as a result of cin trying to convert the user input to an int, you will better understand how to deal with the problem. :davis: |
|
#8
|
|||
|
|||
Re: If "x" isn't a number...?I tried, cin converts char to "2"... I can solve the problem with
CPP / C++ / C Code:
Maybe, I appear stupid, but i can't solve it... Thanks Davis. for your answers.. edit: Sorry, this couldn't solve it, too... |
Recent GIDBlog
Vista ?Widgets? on Windows XP by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Random Number Generator Help | jj9187 | C Programming Language | 2 | 12-Feb-2007 23:25 |
| Need Help with my Cards Program (C++) | krisopotamus | C++ Forum | 2 | 06-Oct-2005 16:48 |
| Knights Tour - Reloaded . | kobi_hikri | C Programming Language | 12 | 03-Oct-2005 12:15 |
| Roman to decimal to roman | SpudNuts | C++ Forum | 2 | 16-Feb-2005 19:44 |
| Anyone can write a program code for this??? | chriskan76 | C Programming Language | 1 | 19-Oct-2004 20:25 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The