Okay, so I decided to make a temperature converter between Celsius and Fahrenheit.
I recently found out about set /a, and wanted to use the arithmetic function to good use.
When I run it, it says "Missing operand", but otherwise continues the code.
So something is obviously wrong with my math. Can someone help?
Here is the code:
:A
@echo off
title Temperature Converter
set /p celorfah=Enter the degrees you are converting from [c/f]:
cls
if %celorfah%==c (
set /p celtemp=Enter the temperature in Celsius:
cls
set /a celmath1=%celtemp%*9
set /a celmath2=%celmath1%/5
set /a celtofah=%celmath2%+32
echo The temperature in Celsius is %celtemp%.
echo The temperature in Fahrenheit is %celtofah%.
echo.
pause
cls
goto A
)
if %celorfah%==f (
cls
set /p fahtemp=Enter the temperature in Fahrenheit:
cls
set /a fahmath1=%fahtemp%-32
set /a fahmath2=%fahmath1%*5
set /a fahtocel=%fahmath2%/9
echo The temperature in Fahrenheit is %fahtemp%.
echo The temperature in Celsius is %fahtocel%.
echo.
pause
goto A
)
cls
echo That isn't an option!
echo.
pause
goto A
Thank you!