coding help I'm a epic noob !! lol

Only part of the code that doesn't work, Trying to get this part of coding to accept one decimal e.g 2.34 and if there was 2.3454.54 the output would be X.
I know you do this with string but coding hasn't worked out well


if (argc==4)
{
float num1= atof(argv[1]);
float num2 = atof(argv[2]);
string operation = argv[3];
int decCount(0);
string ch1 = (argv[1]);
string ch2 = (argv[2]);


if(ch1 = ".")
{ decCount ++ ;
if(decCount > 1 )
{ cout << " X " << endl;}
}

if(ch2 = ".")
{ decCount ++ ;
if(decCount > 1)
{cout << "X" << endl;}
}

_________________________________ After this Part works
if(operation == "a")
{cout << num1+num2 << endl;}


..... code continues.


Thanks for any help


Last edited on
So you're trying to check if a number only has a certain number of numbers after the decimal place?
No i'm checking for decimal points which is the dot "." anything with more than one dot should cout X
Topic archived. No new replies allowed.