Posts

Showing posts from September, 2020

code for finding roots of a quadratic equation

#inc lude   <iostream> #include   <cmath> int   main () {    double   a  ;    double   b  ;    double   c  ;    std :: cout   <<   "Enter a :"  ;    std :: cin   >>   a  ;    std :: cout   <<   "Enter b :"  ;    std :: cin   >>   b  ;    std :: cout   <<   "Enter c :"  ;    std :: cin   >>   c  ;       double   root1  ;    double   root2  ;   //the positive root    root1   = (- b  +  std :: sqrt ( b * b  -  4 * a * c )) / ( 2 * a ) ;   //the negative root    root2  = (- b  -  std :: sqrt ( b * b  -...
  1. Optional:  Little Mac is an interplanetary space boxer, who is trying to win championship belts for various weight categories on other planets within the solar system. Write a  space.cpp  program that helps him keep track of his target weight by: 1.      It should ask him what his earth weight is. 2.      Ask him to enter a number for the planet he wants to fight on. 3.      It should then compute his weight on the destination planet. Here is the table of conversion: # Planet Relative Gravity 1 Mercury 0.38 2 Venus 0.91 3 Mars 0.38 4 Jupiter 2.34 5 Saturn 1.06 6 Uranus 0.92 7 Neptune 1.19 Hint To compute his weight on the plan...