有人可以将这个c ++代码转换为c#谢谢!! [英] Can Some one please convert this c++ code to c# thank you!!
问题描述
/ *
这是课程要求,他们不允许我使用c ++而不是c#,我无法忍受输入,大多数在线编译器都不值得用c#,关于c#的微软学习网站不是很有趣
比较其他编程语言。
* /
#include< iostream>
#include< ; cmath>
#include< iomanip>
#include< string>
使用命名空间std ; $
int main()
{
std :: cout<<""货币转换器"<< std :: endl;
//声明的变量
double Au = 0.8,Us = 1.0;
double output1,input1,input2, output2;
std :: cout<< " ---------------------"<< std :: endl;
std :: cout<<" Au |给我们:$"<< std :: flush;
cin>> input1;
output1 = Au / Us * input1;
// output1 = Us / Au * input1;
std :: cout<< " ---------------------"<< std :: endl;
std :: cout<<" $ 1 Aud to Us is $"<< output1<< std :: endl;
std :: cout<< " ---------------------"<< std :: endl;
std :: cout<<" Us to Au:$"<< std :: flush;
cin>> input2;
output2 = Us / Au * input2;
// output2 = Au / Us * input2;
std :: cout<< " ---------------------"<< std :: endl;
std :: cout<< "$ 1 Us to Au is $"<< output2<< std :: endl;
std :: cout<< " ---------------------"<< std :: endl;
返回0;
}
; &NBSP;
您是否尝试过转换器?这是通过有形软件转换器的翻译,但更好的是知道C ++代码的功能,这样你就可以在C#中自己编写它而不进行任何转换。
使用系统;
static int Main()
{
Console.Write(" Currency converter");
Console.Write(" \ n");
//声明的变量
double Au = 0.8;
double Us = 1.0;
double output1;
double input1;
double input2;
double output2;
Console.Write(" ---------------------");
Console.Write(" \ n");
// C ++转换为C#转换器TODO任务:cout'flush'操纵器未被C ++转换为C#转换器:
// ORIGINAL LINE:std :: cout<<" Au to us :
"<<的std ::平齐;
Console.Write(" Au to Us:
");
input1 = double.Parse(ConsoleInput.ReadToWhiteSpace(true));
output1 = Au / Us * input1;
// output1 = Us / Au * input1;
Console.Write(" ---------------------");
Console.Write(" \ n");
Console.Write("
/*
It's a course requirement, they will not allow my to use c++ rather c#, I cannot stand the inputs, and most online compilers are hardly worth using with c#, the Microsoft learning site in regards to c# is not interesting compared to other programming languages.
*/
#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
std::cout<<"Currency converter"<<std::endl;
// Declared variables
double Au = 0.8, Us = 1.0;
double output1, input1, input2, output2;
std::cout << "--------------------- "<<std::endl;
std::cout <<"Au to Us: $"<<std::flush;
cin >> input1;
output1 = Au / Us * input1;
//output1 = Us / Au * input1;
std::cout << "--------------------- "<<std::endl;
std::cout <<"$1 Aud to Us is $"<<output1<<std::endl;
std::cout << "--------------------- "<<std::endl;
std::cout <<"Us to Au: $"<<std::flush;
cin >> input2;
output2 = Us / Au * input2;
//output2 = Au / Us * input2;
std::cout << "--------------------- "<<std::endl;
std::cout << "$1 Us to Au is $"<<output2<<std::endl;
std::cout << "--------------------- "<<std::endl;
return 0;
}
Have you tried a converter? Here is a translation via Tangible software converter yet what is even better is to know what the C++ code does so you can write it yourself in C# without doing a conversion at all.
using System; static int Main() { Console.Write("Currency converter"); Console.Write("\n"); // Declared variables double Au = 0.8; double Us = 1.0; double output1; double input1; double input2; double output2; Console.Write("--------------------- "); Console.Write("\n"); //C++ TO C# CONVERTER TODO TASK: The cout 'flush' manipulator is not converted by C++ to C# Converter: //ORIGINAL LINE: std::cout <<"Au to Us:
"<<std::flush; Console.Write("Au to Us:
"); input1 = double.Parse(ConsoleInput.ReadToWhiteSpace(true)); output1 = Au / Us * input1; //output1 = Us / Au * input1; Console.Write("--------------------- "); Console.Write("\n"); Console.Write("
这篇关于有人可以将这个c ++代码转换为c#谢谢!!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!