Question: How do I get negative increment in the same code? I was managed to get a positive increment but a negative increment won't work. Can

 How do I get negative increment in the same code? Iwas managed to get a positive increment but a negative increment won't

work. Can you help me out? I have attached my code #include

How do I get negative increment in the same code? I was managed to get a positive increment but a negative increment won't work. Can you help me out? I have attached my code

#include

using namespace std;

int main() {

float conversion_type; float starting_temp; float ending_temp; float increment; float temp_holder; float new_temp; int counter = 1;

cout Celsius" Fahrenheit" > conversion_type; cout > starting_temp;

cout > ending_temp;

cout > increment;

cout

if (ending_temp > starting_temp) {

starting_temp = starting_temp; ending_temp = ending_temp; } else { temp_holder = ending_temp; ending_temp = starting_temp; starting_temp = temp_holder;

}

for (int i = starting_temp; i

{ if (conversion_type == 1) { float Fahrenheit2Celsius = (i - 32) * (5.0 / 9.0); cout

else if (conversion_type == 2) { float Celsius2Fahrenheit = (i * (9.0 / 5.0)) + 32.0; cout

return 0; }

WRITE A NEW C++ PROGRAM THAT GENERATES A CONVERSION TABLE FOR A RANGE OF TEMPERATURES. THE INPUT CAN BE EITHER IN FAHRENHEIT OR IN CENTIGRADE. THE USER WILL ALSO ENTER A STARING TEMPERATURE, AND ENDING TEMPERATURE AND AN INCREMENT THAT USED TO ADVANCE THROUGH THE TABLE. FOR EXAMPLE IF THE USER ENTER THE FOLLOWING INFORMATION AFTER THE PROGRAM, PROMPT FOR INPUT: EXAMPLE RUN #1: PLEASE CHOOSE FROM THE MENU BELOW 1. Fahrenheit --> Celsius 2. Celsius --> Fahrenheit Fahrenheit) Conversion type : 2 Converting from (Celsius --> Starting temperature : 0 Ending temperature : 100 Increment : 2 CELSIUS TEMPERATURE # 1 2 3 FAHRENHEIT TEMPERATURE 32 35.6 39.2 H... ANO . .... 51 100 212 THE PROGRAM MUST BE ADOPT TO DIFFERENT USER INPUT. IN CASE THE STARTING TEMPERATURE IS GREATER THAN THE ENDING TEMPERATURE AND THE INCREMENT IS POSITIVE. THE PROGRAM CHOOSES THE STARTING TO BE THE SMALLER AND ENDING TO BE THE LARGER TEMPERATURE. EXAMPLE RUN #2: PLEASE CHOOSE FROM THE MENU BELOW 1. Fahrenheit --> Celsius 2. Celsius --> Fahrenheit Conversion type : 1 Converting from (Fahrenheit --> Celsius) Starting temperature : 180 Ending temperature : 0 Increment : 2.5 FAHRENHEIT TEMPERATURE # 1 2 3 CELSIUS TEMPERATURE -17.77 -16.38 2.5 5.0 -15 .. ... : 72 180 82.22 IN CASE THE INCREMENT WAS A NEGATIVE NUMBER, THE STARTING POINT IS THE LARGEST AND THE ENDING POINT IS THE SMALLER. EXAMPLE RUN #3: PLEASE CHOOSE FROM THE MENU BELOW 1. Fahrenheit --> Celsius 2. Celsius --> Fahrenheit Conversion type : 1 Converting from (Celsius --> Fahrenheit) Starting temperature : 25 Ending temperature : 50 Increment : -3.25 CELSIUS TEMPERATURE 50 46.75 43.50 FAHRENHEIT TEMPERATURE 122 116.15 110.3 00!!! WNF# N... 27.25 81.05

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!