C / C ++中的模式匹配 [英] Pattern Matching in C/C++

查看:63
本文介绍了C / C ++中的模式匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C / C ++中学过一门编程语言。我想制作一个试图比较两个数组(随机字符)的程序,并通知用户不同的数据。该程序必须通知插件和插入/删除。


以下是示例:


数组1:xxxxxxxxx ...(作为标准)

数组2:xxx y xxxxx ...


程序将通知,

4号中有小号





数组1:xxxxxxx ..

数组2:xx yy xxxxx ..


在第3个插入yy


我'我用条件设计了算法if,但是当我用于变体数据时,它们仍然是很多错误(array2)

解决方案

你得到了什么错误?代码是什么样的。请将相应的代码段与代码标签一起发布。


问候

Dheeraj Joshi


我不知道知道错误机制,

这个算法导致错误的分析输出..


这里是代码(在C#中)但是我想把它移植到C ++

展开 | 选择 < span class =codeDivider> | Wrap | 行号


如果你知道两个数组的总索引,你可以比较每个索引和打印输出,在索引结束之前,输出会有所不同。

I''ve learned a programming language in C/C++. I want to make a program which try to compare two arrays (random chars)and notify the user about the differrents. The program have to notify both the subtitution and insertion/deletion.

Here are the examples :

array 1 : xxxxxxxxx...(as standard)
array 2 : xxxyxxxxx...

the program will notify that,
"there are subtitution in 4th"

and

array 1 : xxxxxxx..
array 2 : xxyyxxxxx..

"there are insertion yy at 3rd"

I''ve designed the algorithm with conditional if, but they are still many bugs when i''m used on variant data (array2)

解决方案

What errors you are getting? What does the code look like. Please post the appropriate code snippet along with code tags.

Regards
Dheeraj Joshi


i don''t know the error mechanism,
this algorithm results the wrong analyze output..

here is the code (in C#) but i want to porting it to C++

Expand|Select|Wrap|Line Numbers


if you know the total index of two arrays, you can compare the each and every index and print the output, which one is getting differed until end of the index.


这篇关于C / C ++中的模式匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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