p或~p [英] p or ~p

查看:76
本文介绍了p或~p的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的逻辑有点模糊。在一个法律上不可接受的环境中,一位女士给我签了4封信。由于新近,最后我可以识别为''e''。

我今天早上无法验证。另外两个是{''r'',''a''}

或{'''',''r}。订单很重要。有没有人在c中模糊逻辑看到了单词

问题的处理? EC

My logic is a little fuzzy. In a legally-inadmissable setting a woman
signed 4 letters to me. Because of recency, the last I can identify as ''e''.
One I could not verify this morning. The other two were either {''r'', ''a''}
or {''a'', ''r}. Order matters. Has anyone seen a treatment of the word
problem with fuzzy logic in c? EC

推荐答案

Elijah Cardon发布:
Elijah Cardon posted:

我的逻辑有点模糊。
My logic is a little fuzzy.



你的语言也是如此。


So is your language.


在法律上不可接受的情况下,女人< br $>
给我签了4封信。
In a legally-inadmissable setting a woman
signed 4 letters to me.



具体。


(1)字母表中的字母

(2)一个人写给另一个人的一封信


Be specific.

(1) A letter of the alphabet
(2) A letter which a person writes to another person


由于新近,最后我可以识别为''e''。
Because of recency, the last I can identify as ''e''.



没有任何意义,但我隐约知道你想要兑现
表示最近的一封信更多比之前的

更难忘。


Makes no sense whatsoever, but I vaguely get the idea that you''re trying to
convey that the most recent letter is more memorable than the previous
ones.


今天早上我无法验证。
One I could not verify this morning.



其中一个是什么?这些字母?


One of what? The letters?


其他两个是{''r'',''a''}或{''a''',' 'R''}。
The other two were either {''r'', ''a''} or {''a'', ''r''}.



哦,所以你在谈论字母表的字母?


Oh, so you''re talking about letters of the alphabet?


订单很重要。有没有人在c中看到过用
模糊逻辑处理单词问题?
Order matters. Has anyone seen a treatment of the word problem with
fuzzy logic in c?



四个字母。其中一个是e。在''r'旁边有一个''a''。

编码应该不难:


int ContainsE (char const * p)

{

for(;;)

{

switch(* p ++)

{

case''e'':返回1;


案例0:返回0;

}

}

}


int HasAbesideR(char const * p)

{

for(;;)

{

switch(* p ++)

{

case''a'':if(''r''== p [1])返回1;

case''r'':if(''a''= = p [1])返回1;


案例0:返回0;

}

}

}


#include< string.h>


int FitsCriteria(char const * p)

{

返回4 == strlen(p)&&包含E(p)&& HasAbesideR(p);

}


现在你所要做的就是打开一个字典文本文件并运行每个单词

通过它。


-


Frederick Gotham


Four letters. One of them is ''e''. There''s an ''a'' directly beside an ''r''.
Shouldn''t be hard to code:

int ContainsE(char const *p)
{
for(;;)
{
switch(*p++)
{
case ''e'': return 1;

case 0: return 0;
}
}
}

int HasAbesideR(char const *p)
{
for(;;)
{
switch(*p++)
{
case ''a'': if(''r'' == p[1]) return 1;
case ''r'': if(''a'' == p[1]) return 1;

case 0: return 0;
}
}
}

#include <string.h>

int FitsCriteria(char const *p)
{
return 4==strlen(p) && ContainsE(p) && HasAbesideR(p);
}

Now all you have to do is open a dictionary text file and run every word
through it.

--

Frederick Gotham


Frederick Gotham发布:
Frederick Gotham posted:

switch(* p ++)

{

case''a'':if(''r ''== p [1])返回1;
switch(*p++)
{
case ''a'': if(''r'' == p[1]) return 1;



Wups,我需要一个休息那里。


Wups, I need a "break" there.


case''r'':if(''a''== p [1])返回1;
case ''r'': if(''a'' == p[1]) return 1;



在这里。


-


Frederick Gotham




我可以提高效率:


int FitsCriteria(char const * p)

{

char const * const pover = p + 4;


int contains_e = 0,has_a_beside_r = 0;


do

{

开关(* p ++)

{

case''e'':

{

if(has_a_beside_r)返回1;


contains_e = 1 ;

}

休息;


案例''a'':

{

if(''r''== p [1])

{

if(contains_e)返回1;


has_a_beside_r = 1;

}

}

休息;


case''r'':

{

if(''a'= = p [1])

{

如果(contains_e)返回1;


has_a_beside_r = 1;

}

}

休息;


案例0:返回0;

}

}

while(pover!= p);


返回0;

}


-


Frederick Gotham

May as well boost the efficiency while I''m at it:

int FitsCriteria(char const *p)
{
char const *const pover = p + 4;

int contains_e = 0, has_a_beside_r = 0;

do
{
switch(*p++)
{
case ''e'':
{
if(has_a_beside_r) return 1;

contains_e = 1;
}
break;

case ''a'':
{
if(''r'' == p[1])
{
if(contains_e) return 1;

has_a_beside_r = 1;
}
}
break;

case ''r'':
{
if(''a'' == p[1])
{
if(contains_e) return 1;

has_a_beside_r = 1;
}
}
break;

case 0: return 0;
}
}
while(pover != p);

return 0;
}

--

Frederick Gotham


这篇关于p或~p的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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