Write a C++ program that inputs a wavelength and then displays the associated light color. If the wavelength is shorter than 400 nm or longer than 700 nm, display the message “Wavelength outside visual range”. Classify boundary wavelengths as the lower-wavelength color. For example, label a wavelength of 424 nm as violet.
agrbinoo.albaker 0 Newbie Poster
Recommended Answers
Jump to Post
if else
statements andboolean
operators will suffice.
Jump to PostYou are using the wrong operator in your if statements. You need to be using the == operator in your if statements, not the = operator!
= is the assignment operator, used to assign a value to a variable.
Whereas == is the test for equality.EDIT:
In fact, the …
All 7 Replies
kal_crazy 13 Junior Poster
agrbinoo.albaker 0 Newbie Poster
JasonHippy 739 Practically a Master Poster
agrbinoo.albaker 0 Newbie Poster
BMA 0 Newbie Poster
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
braian44 0 Newbie Poster Banned
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.