need help with this C++ code

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.
Any reference to learn about this is greatly appreciated.


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
Topic archived. No new replies allowed.