+ 1

Can someone help me with this code in c++?.. I'm a total beginner pls...

1. Write a program that enters the Celsius temperature value and outputs the corresponding Fahrenheit. 2. Write a program, enter a character, if it is an uppercase letter, change it to the corresponding lowercase letter and output it. If it is a digit, change it to the corresponding value and output it. Thanks

27th Feb 2019, 7:43 AM
walka
8 Réponses
+ 1
use cin to get user input. Then you just use calculate the Fahrenheit. And output it with cout
27th Feb 2019, 8:47 AM
M Pax
M Pax - avatar
+ 1
the second one dependents on the ASCII table, there is a built-in function take the imputed char and evaluate it against the ASCII table. after that you say. if this number is > 97 then it is alower case char, so you take that number and subtract 26 you will get the number corresponding to the upper case chare, a built in function again will convert the number to the corresponding upper case char.
27th Feb 2019, 9:00 AM
Ahmad Ali
Ahmad Ali - avatar
0
What about the second question pls
27th Feb 2019, 8:53 AM
walka
0
Use <ctype.h>. There are functions like isupper to check if a character is an uppercase letter and then to use tolower
27th Feb 2019, 8:56 AM
M Pax
M Pax - avatar
0
Can u pls type it out for me to verify??
27th Feb 2019, 9:03 AM
walka
0
i don't know it in c++ but this is the logic.
27th Feb 2019, 9:04 AM
Ahmad Ali
Ahmad Ali - avatar
0
can you please send your code and i see if you tried
27th Feb 2019, 2:53 PM
Avast Zumac
Avast Zumac - avatar
0
#include <iostream> using namespace std; int main() { double celsius,fahrenheit; cin>> celsius ; fahrenheit =celsius+32; cout << "temperature from celsius to fahrenheit is " << fahrenheit <<endl; return 0; }
28th Feb 2019, 11:15 AM
walka