Thread: making less than and greater than work

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    4

    Question making less than and greater than work

    can i do something like this

    if( pollutant < 3.4)
    { cout << " u passed " << endl;
    }

    else
    {
    cout << "u failed " << endl;
    }

    of course the pollutant would have already been inputed. the main question is whether or not using characters up agains numbers will work correctly. thanks for ur help in advance.

  2. #2
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    thats fine, as long as pollutant is defined and has a numeric value you can use < and >
    you can also use
    =>
    =<
    Monday - what a way to spend a seventh of your life

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    4
    thanks

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    154
    You want to declare pollutant as a double or float, like:
    double pollutant;

Popular pages Recent additions subscribe to a feed
Website Security Test