Why don't you post your code? Based on your first post, I don't know why you would need to call isalpha, isdigit or atof at all.
When you post your code, use code tags. They show up as "<>" in the Format menu. Using code tags will make it easier for us to read and comment on your code.
#include "stdafx.h"
#include <iostream>
#include <cstdlib>
#include <errno.h>
usingnamespace std;
constdouble MAXRANGE = 32000;
constdouble MINRANGE = -32000;
int main(int argc, char *argv[])
{
// err 1 - If the number of parameters is 1 then the program MUST print ID string .
if (argc == 1)
{
cout << "3423390" << endl ;
return 0 ;
}
/* err 1- If the number of parameters is 2 the output shall be 'P' which signals a Parameter error
If the number of parameters is more than 3, the output shall be 'P'.*/
if(argc==2 || argc>=4)
{
cout<<"P"<<endl;
return 0;
}
if(argc==3)
{
int num1=atol(argv[1]);
int num2=atol(argv[2]);
int result=(num1+num2);
{
/*err-3 All input numbers must be between (and including) +32000 or -32000, but
excluding Zero*/
/*err-3 If any operands are not valid decimal numbers the output shall be 'X'.
NB: 1.3 is valid, ABC123 is not valid, 1.3.4 is not valid, 123abc is not valid.
Using a comma separator: 1,000.9 is commonly considered valid
(but remember: atof() will read this as '1' not as 1000.9 ).
Scientific format is usually considered valid e.g. 1.23e2
These input values will be tested for*/
{if ((isalpha(*argv[1]))||(isalpha(*argv[2])))
cout<<"X"<<endl;
elseif ((isdigit(*argv[1]))||(isalpha(*argv[2])))
if((num1>32000)||(num1<-32000)||(num2>32000)||(num2<-32000)||(num2==0)||(num1==0))
cout<<"R"<<endl;
else
cout<<result<<endl;
return 0;}
}
}
}
Try using strtod (http://www.cplusplus.com/reference/cstdlib/strtod/). This will give you your floating point value, and you can use endPtr to determine if there are extra values after the last character that you converted. (endPtr - str should equal strlen(str))
Strtod also handle scientific notation, too, so you should be all set.