Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

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

Computer Science
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Join Brainly to access

this expert answer

SIGN UP FOR FREE
// // main.cpp // week5-4-4 #include #include 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; }
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?
You cannot use the modulus operator with a double.

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

what is a "modulus operator" ?
%
Use this instead: if (fmod(sqrt(a),1.0) == 0)
wait a min, but why I cant use % with doubles?
Because it is designed to take an integer.
hmm hold on lemme try
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

Not the answer you are looking for?

Search for more explanations.

Ask your own question