Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

Christos Group Title

C++ Help needed! The program I need to build is supposed to do this: http://screencast.com/t/qbp34sVfC

  • one year ago
  • one year ago

  • This Question is Closed
  1. Christos Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    // // main.cpp // week5-4-4 #include <iostream> #include <cmath> using namespace std; int main() { double a; cin >> a; if (sqrt(a)%1.0 == 0) cout << "It's an integer."; else cout << "It's NOT an integer. Sorry."; return 0; }

    • one year ago
  2. Christos Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    This is the code I created for the problem. I don't know why it doesn't run. Can you help me spot the problem?

    • one year ago
  3. eSpeX Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    You cannot use the modulus operator with a double.

    • one year ago
  4. Christos Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    what is a "modulus operator" ?

    • one year ago
  5. eSpeX Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    %

    • one year ago
  6. eSpeX Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Use this instead: if (fmod(sqrt(a),1.0) == 0)

    • one year ago
  7. Christos Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    wait a min, but why I cant use % with doubles?

    • one year ago
  8. eSpeX Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Because it is designed to take an integer.

    • one year ago
  9. Christos Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    hmm hold on lemme try

    • one year ago
  10. Anniepoo Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    You might also have trouble with the == it's always iffy to compare doubles. think of all the times a computer's told you 2.0 + 2.0 = 3.99999999

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.