How to convert this curl command in c#?

Converting a value in the command line in c++?

  • Write a C++ program to read in the command line arguments and then calculate the result in terms of Fahrenheit or Celsius depending on the input. This question is to convert a value stored in the command line either from Fahrenheit (F) to Celsius (C) or vice versa. The mathematical relationship between Fahrenheit and Celsius can be expressed as: Fahrenheit = (9.0 / 5.0) x C + 32 a. Write a C++ program to read in the command line arguments and then calculate the result in terms of Fahrenheit or Celsius depending on the input. Example 1 If the command line has the expression “212 Fahrenheit”, then the output would be: Your input is 212 Fahrenheit Result is 100 Celcius Press any key to continue... Example 2 If the command line has the expression “37 Celsius”, then the output would be: Your input is 37 Celsius Result is 98.6 Fahrenheit Press any key to continue....

  • Answer:

    OLD homework = #include <iostream> using namespace std; int main() { int choice = 0; int FTemp = 0; int CTemp = 0; { cout << endl; cout << "1.Fahrenheit to Celsius" << endl; cout << "2.Celsius to Fahrenheit" << endl; cout << "Choice: "; cin >> choice; if (choice == 1) { cout << "Enter the temperature in Fahrenheit: "; cin >> FTemp; CTemp = (FTemp - 32)/1.8; cout << "Temperature (Celsius) = " << CTemp << endl; } else if (choice == 2) { cout << "Enter the temperature in Celsius: "; cin >> CTemp; FTemp = (CTemp * 1.8) + 32; cout << "Temperature (Fahrenheit) = " << FTemp << endl; } } return 0; }

luke at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

OLD homework = #include <iostream> using namespace std; int main() { int choice = 0; int FTemp = 0; int CTemp = 0; { cout << endl; cout << "1.Fahrenheit to Celsius" << endl; cout << "2.Celsius to Fahrenheit" << endl; cout << "Choice: "; cin >> choice; if (choice == 1) { cout << "Enter the temperature in Fahrenheit: "; cin >> FTemp; CTemp = (FTemp - 32)/1.8; cout << "Temperature (Celsius) = " << CTemp << endl; } else if (choice == 2) { cout << "Enter the temperature in Celsius: "; cin >> CTemp; FTemp = (CTemp * 1.8) + 32; cout << "Temperature (Fahrenheit) = " << FTemp << endl; } } return 0; }

tbshmkr

include<iostream> #include<cstring> using namespace std; int main(int N, char *a[]) { float ft, ct; if(N!=3) exit(-1); ft=atof(a[1]); if(strcmp(a[2], "Celcius")) { ct=9.0*5*ft+32; cout<<ct<<"Farenheit"<<endl; } else { ct=5.0/9*(ft-32); cout<<ct<<"Celcius"<<endl; } return 0; }

James Bond

include<iostream> #include<cstring> using namespace std; int main(int N, char *a[]) { float ft, ct; if(N!=3) exit(-1); ft=atof(a[1]); if(strcmp(a[2], "Celcius")) { ct=9.0*5*ft+32; cout<<ct<<"Farenheit"<<endl; } else { ct=5.0/9*(ft-32); cout<<ct<<"Celcius"<<endl; } return 0; }

James Bond

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.