Saturday, May 22, 2010

C++ help challenging!?

I have to input integer for c++ code how can i check whether the user input integer or a string character?


then if he input a charecter how to prompt him to enter integer again(just not using isdigit lke function because i want calculate something using if that is an integer it cant'b done using above function because it want to declare variable in char tpe but i want check using intrger type

C++ help challenging!?
use the functions


islower,isupper,tolower,toupper,isalph...


available in ctype.h
Reply:just use char string type for your input so that you can use the isdigit function to check if it is an integer


then just use the atoi function to convert the char string input into an integer type.
Reply:pseudocode





char i;


while i is not equal to (0-9)


output "enter a number"


loop





when you come out of the loop you will have a number.
Reply:Or else you may contact a C++ expert at websites like http://oktutorial.com/


No comments:

Post a Comment