+ 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
8 Answers
+ 1
use cin to get user input. Then you just use calculate the Fahrenheit. And output it with cout
+ 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.
0
What about the second question pls
0
Use <ctype.h>. There are functions like isupper to check if a character is an uppercase letter and then to use tolower
0
Can u pls type it out for me to verify??
0
i don't know it in c++ but this is the logic.
0
can you please send your code and i see if you tried
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;
}