如何将我的C#代码转换为C ++? [英] How can i convert my C# code to C++ ?

查看:106
本文介绍了如何将我的C#代码转换为C ++?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我有以下Csharp代码。如何将其转换为C ++ Conselo? 


我也尝试编写相同的C ++代码。你能继续吗?


谢谢。

使用System; 
使用System.Collections.Generic;使用System.ComponentModel
;
使用System.Data;使用System.Drawing
;
使用System.Linq;
使用System.Text;
使用System.Threading.Tasks;
使用System.Windows.Forms;

名称空间passtext
{
公共部分类Form1:表格
{
public Form1()
{
InitializeComponent() ;
}

字符串text1,text2;
int ch;

private void button1_Click(object sender,EventArgs e)
{
text1 ="" ;;
text2 ="" ;;
text1 = textBox1.Text;

foreach(char ch in text1)
{
if(ch.ToString()==" a")
{
text2 + = "!,英寸;

}
else if(ch.ToString()==" e")
{
text2 + ="?," ;;
}
else if(ch.ToString()=="ı" || ch.ToString()==" i")
{
text2 + =" ;(," ;;
}
else if(ch.ToString()==" o" || ch.ToString()=="ö")
{
text2 + =" ve";
}
else if(ch.ToString()==" u" || ch.ToString()=="ü")
{
text2 + ="#" ;;
}
else
{
text2 + = ch.ToString();
}
}
textBox2.Text = text2;

}
}
}




#include< iostream> 
#include< string.h>

using namespace std;
void passtext(string text1)
{


for(auto str:text1)//我这行有错误。
{
}
cout<< text2;



}

int main(){
string text1;
string text2;
cout<<" text:" ;;
得到(text1);
cout<<" passtext:" ;;
sif(text1);
得到(text1);
返回0;
}

解决方案

< blockquote>

你可以试试转换器


https: //www.tangiblesoftwaresolutions.com/product_details/csharp_to_cplusplus_converter_details.html


Hello,

I have below Csharp code. How can i convert it to C++ Conselo ? 

I also try to code same C++. Can you go on please ?

Thanks.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace passtext
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        String text1,text2;
        int ch;
 
        private void button1_Click(object sender, EventArgs e)
        {
            text1 = "";
            text2 = "";
            text1 = textBox1.Text;

            foreach (char ch in text1)
            {
                if (ch.ToString() == "a")
                {
                    text2 += "!,";

                }
                else if (ch.ToString() == "e")
                {
                    text2 += "?,";
                }
                else if (ch.ToString() == "ı" || ch.ToString() == "i")
                {
                    text2 += "(,";
                }
                else if (ch.ToString() == "o" || ch.ToString() == "ö")
                {
                    text2 += "ve";
                }
                else if (ch.ToString() == "u" || ch.ToString() == "ü")
                {
                    text2 += "#";
                }
                else
                {
                    text2 += ch.ToString();
                }
                }
                    textBox2.Text = text2;

                }
                }
}


#include <iostream>
#include <string.h>

using namespace std;
void passtext(string text1)
{

	
for(auto str: text1) // I have error this line.
		{
	}
			cout<<text2;
	
			

}

int main(){
	string text1;
	string text2;
	cout <<"text: ";
	gets(text1);
	cout<<"passtext: ";
	sif(text1);
	gets(text1);
	return 0;
}

解决方案

you can try a converter

https://www.tangiblesoftwaresolutions.com/product_details/csharp_to_cplusplus_converter_details.html


这篇关于如何将我的C#代码转换为C ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆