[求助]救救小妹吧。。不会做的 c语言题。。>o
dogxbxxxnoon
bhellotherec
akciuqbrownm
xxxgexlahjij
xbzoxvuxxxox
xlxdzxexxxjx
xuxxblxnkgod
大家都有看过报章杂志上这类 word puzzle 的游戏。。(就找英文单字啊,打横打直,斜上或斜下的..)
小妹我的作业呢就是要用 c语言, 从以上的字母中找到
hello
dog
brown
join
row
quick
averyverylongword
noon
z
blue
blunt
help
even
blink
还要把那些字都自动用颜色 highlight 起来, 和显示结果,
The word "hello" was found 1 time in the grid.
The word "dog" was found 3 times in the grid.
The word "brown" was found 1 time in the grid.
The word "join" was found 1 time in the grid.
The word "row" was found 1 time in the grid.
The word "quick" was found 1 time in the grid.
The word "averyverylongword" was NOT found in the grid.
The word "noon" was found 2 times in the grid.
The word "z" was found 2 times in the grid.
The word "blue" was found 2 times in the grid.
The word "blunt" was NOT found in the grid.
The word "help" was NOT found in the grid.
The word "even" was found 1 time in the grid.
The word "blink" was NOT found in the grid.
过几天就要交了,但我还是完全不董要怎么做啊。。
那位哥哥或姐姐可以救救我啊。。!!?
拜托拉。。 >,<
我的e-mail, iam_nicole87@yahoo.com
----------------解决方案--------------------------------------------------------
小姑娘,你学的是什么专业?怎么会有这么难得题?
----------------解决方案--------------------------------------------------------
题不难,关键怎样才能判断是一个单词呢?
----------------解决方案--------------------------------------------------------
暴力穷举肯定能出答案(虽然很慢).................
----------------解决方案--------------------------------------------------------
我选读工程师了啦。。
谁知道有那么难得东西啊。。 ToT
我数学和科学都很好丫。。
就天生电脑白痴。。 >.<
各位哥哥一定要救救我丫。。
----------------解决方案--------------------------------------------------------
很难的题啊
我可没做过这么难的
考虑一下先
----------------解决方案--------------------------------------------------------
你提供的dogxbxxxnoon
bhellotherec
akciuqbrownm
xxxgexlahjij
xbzoxvuxxxox
xlxdzxexxxjx
xuxxblxnkgod
里面 没有
averyverylongword 这个啊?
----------------解决方案--------------------------------------------------------
以下是引用nicole在2006-8-29 15:36:26的发言:
大家都有看过报章杂志上这类 word puzzle 的游戏。。(就找英文单字啊,打横打直,斜上或斜下的..)
小妹我的作业呢就是要用 c语言, 从以上的字母中找到
hello
dog
brown
join
row
quick
averyverylongword
noon
z
blue
blunt
help
even
blink
还要把那些字都自动用颜色 highlight 起来, 和显示结果,
The word "hello" was found 1 time in the grid.
The word "dog" was found 3 times in the grid.
The word "brown" was found 1 time in the grid.
The word "join" was found 1 time in the grid.
The word "row" was found 1 time in the grid.
The word "quick" was found 1 time in the grid.
The word "averyverylongword" was NOT found in the grid.
The word "noon" was found 2 times in the grid.
The word "z" was found 2 times in the grid.
The word "blue" was found 2 times in the grid.
The word "blunt" was NOT found in the grid.
The word "help" was NOT found in the grid.
The word "even" was found 1 time in the grid.
The word "blink" was NOT found in the grid.
过几天就要交了,但我还是完全不董要怎么做啊。。
那位哥哥或姐姐可以救救我啊。。!!?
拜托拉。。 >,<
我的e-mail, iam_nicole87@yahoo.com
没有发现的没有发现了,不过 我也不会! dogxbxxxnoon
bhellotherec
akciuqbrownm
xxxgexlahjij
xbzoxvuxxxox
xlxdzxexxxjx
xuxxblxnkgod
大家都有看过报章杂志上这类 word puzzle 的游戏。。(就找英文单字啊,打横打直,斜上或斜下的..)
小妹我的作业呢就是要用 c语言, 从以上的字母中找到
hello
dog
brown
join
row
quick
averyverylongword
noon
z
blue
blunt
help
even
blink
还要把那些字都自动用颜色 highlight 起来, 和显示结果,
The word "hello" was found 1 time in the grid.
The word "dog" was found 3 times in the grid.
The word "brown" was found 1 time in the grid.
The word "join" was found 1 time in the grid.
The word "row" was found 1 time in the grid.
The word "quick" was found 1 time in the grid.
The word "averyverylongword" was NOT found in the grid.
The word "noon" was found 2 times in the grid.
The word "z" was found 2 times in the grid.
The word "blue" was found 2 times in the grid.
The word "blunt" was NOT found in the grid.
The word "help" was NOT found in the grid.
The word "even" was found 1 time in the grid.
The word "blink" was NOT found in the grid.
过几天就要交了,但我还是完全不董要怎么做啊。。
那位哥哥或姐姐可以救救我啊。。!!?
拜托拉。。 >,<
我的e-mail, iam_nicole87@yahoo.com
----------------解决方案--------------------------------------------------------
笨办法 大家参考
定义数组 char s[]="dogxbxxxnoonbhellotherecakciuqbrownmxxxgexlahjijxbzoxvuxxxoxxlxdzxexxxjxxuxxblxnkgod"
循环查找单词特定字母
如hello 首先查h接着往下单词结束
int a=1; 查到的不查
int k=1; 判断单词有没全找到
while(s[i]!='\0')
{
printf("%c",s[i]);
if (a)
{
if ('h'==a[i])
{
textcolor(3); 改变字颜色
cprintf(a[i]);
a=0;k++; 如果找到 a 为0 下次不找了 K++ 已找到单词+1
}
}
依次 e ,l, l, o
i++;
}
if (k!= hello的长 那么没找到;
----------------解决方案--------------------------------------------------------
用穷举法做了一点,太麻烦了!就做不下去了。
有哪位同行知道简单一点的算法?
----------------解决方案--------------------------------------------------------