I need help!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DaRok28
    New Member
    • Feb 2007
    • 8

    I need help!

    I am writing a program that is calculating windchill but I have two errors that I need help with because I am a just learning how to program.

    Program1.cpp:22 : error: no match for ‘operator<<’ in ‘ (&std: :cin) ->std: :basic_istream< _CharT, _Traits>: :operator>> [with _CharT = char, _Traits = std: :char _traits<char>](((double&)(&dT emperature))) <<std: :endl’

    Program1.cpp:24 : error: no match for ‘operator<<’ in ‘ (&std: :cin) ->std: :basic_istream< _CharT, _Traits>: :operator>> [with _CharT = char, _Traits = std: :char _traits<char>](((double&)(&dw indspeed))) <<std: :endl’

    So if anyone could tell me what these mean.
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    Could you post the code you are trying to compile? I expect you have made a typing error in your output statements.

    Comment

    • DaRok28
      New Member
      • Feb 2007
      • 8

      #3
      Originally posted by Ganon11
      Could you post the code you are trying to compile? I expect you have made a typing error in your output statements.
      Code:
      #include <iostream>
      #include <cmath>
      using namespace std;
      
      int main()
      (
         char cAgain;
         double fWindchill, fTemperature, fWindspeed;
         
         do     
         (
             cout.setf(ios: :fixed);
             cout.setf(ios: :showpoint);   
             cout.precision(4);
             cout << endl << “Please enter temperature, in degrees Celcius”;
             cin >> fTemperature << endl;
             cout << endl << “Please enter windspeed, in meters/second” << endl;
             cin >> fWindspeed << endl;
             fwindchill = 13.12 + (o.6251 * fTemperature) – 11.37 * pow(fWindspeed, 0.16) + (0.3956 * pow(fWindspeed, 0.16));
             cout << “Temperature is ” << fTemperature << “ degrees Celcius.”;
             cout << “Windspeed is “ << fWindspeed << “ meters/second.”;
             cout << “Windchill index is “ << fWindchill << “ degrees Celcius.”;
             cout << endl << “Run this calculation again? Y/y/N/n” << endl;
             cin >> cAgain;
         )while (cAgain == ‘Y’ || cAgain == ‘y’);
      
         cout << endl << “Thankyou for using this program!” << endl;
      
         return 0;
      
      )
      I am not even sure if this is the correct way to calulate windchill, but if it can help me fix those errors i might be able to proceed with fixing it, thanks.

      Comment

      • Ganon11
        Recognized Expert Specialist
        • Oct 2006
        • 3651

        #4
        The first two cin statements in your loop are what's giving you errors. In both cases, you use cin >> to input to a variable, but then you use << to try and output an endl. << can only be used with cout, the output device - cin is only used for input.

        Comment

        Working...