Ask your own question, for FREE!
Computer Science 14 Online
sleepyjess:

@ultrilliam

Ultrilliam:

Ahoy there :)

sleepyjess:

trying to figure out how to get it from the program to my actual desktop files...

nuts:

sleepyjess, get what from the program to your actual desktop files?

Ultrilliam:

And is it a C++ script jess?

nuts:

so what's the issue @sleepyjess ? and @bm717 why are you spamming on sleepyjess's post? don't you know spamming is a bannable offense?

Ultrilliam:

Sorry about this jess x'D

sleepyjess:

all good lol

sleepyjess:

it does what I want it to do, just wondering if there's a more "efficient" way to do it

nuts:

looks pretty clean for C++ to me. Frankly C++ tends to have a lot of lines for stuff like that, not much you can do about it

sleepyjess:

Professor said we could do something like this: double root = sqrt(discriminant);

nuts:

one small thing you might want to do is explicitly cast the ints into doubles since otherwise the conversion is implicit

Ultrilliam:

Hmmm... *opens notepad++ real quick*

Ultrilliam:

*cause my visual studio installation is broken*

sleepyjess:

If I did the \( double~root = sqrt(discriminant)\), where would I put that in the code?

nuts:

first if statement, but frankly i don't think it's necessary

nuts:

you would need it in the second if statement too, so honestly i think your code is the cleanest

sleepyjess:

Okay, appreciate the help. First week in a coding class, so just trying to make sure I have the hang of everything

nuts:

you're doing well!

Ultrilliam:

I would make a change though, ```cplusplus int a, b, c; double solution1, solution2, discriminant; ```

sleepyjess:

gotcha, didn't realize I could do that

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!