元音发生器 [英] Vowel generator

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

问题描述

当我输入1时,应打印A,E,I,O,U,Y;如果输入2,则输出应为AA,AE,AI,AO,AU,AY ..... EA,EE,EI. .... YY,它应生成到20.

When I Enter 1 it should print A,E,I,O,U,Y and if 2 then output should be AA ,AE,AI,AO,AU,AY.....EA,EE,EI.....YY, it should generate till 20.

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    
    char i;
    int result;
    cout<<"Enter Number\n";
    cin>>result;
        
           for (i ='A'; i <'Z'; i++)
           cout<<" "<<i;
    
    system("PAUSE");
    return 0;
}

推荐答案

生成最多20个组合将花费很长时间.另外,我们不是在这里为您完成工作/家庭作业/面试问题.让我们知道您到目前为止尝试过的具体问题,我们可能会为您提供帮助.
Generating all combinations up to 20 would take a REALLY long time to execute. Also, we are not here to do your work/homework/interview questions for you. Let us know what specific problems you are having with what you''ve tried so far and we may be able to help you.


不管是好是坏,这是您的解决方案(部分解决方案,该解决方案仅会打印20个元音的组合,并用C#编写):
<代码郎= 文本">})(gnirtSoT.onhceTdaBgnortS nruter};))knidrepmuHtrebelgnI(eheheH(dneppA.onhceTdaBgnortS {)detraFgodrednU NI knidrepmuHtrebelgnI margoloH(hcaerof)htgneL.detraFgodrednU(niugnePAnOkcuDA文= onhceTdaBgnortS niugnePAnOkcuDA {)detraFgodrednU] ] staCfOsderdnuH] [tneidarGionoroV citats etavirp}}}; kaerb {)sgnihTetirovaFyMfOemoSerAesehT(FI}}; kaerb; eslaf = sgnihTetirovaFyMfOemoSerAesehT {)第5版,我(FI {)srekcauq NI我margoloH(hcaerof; EURT = sgnihTetirovaFyMfOemoSerAesehT regrubseehCsaHnortageM;) " +) srekcauq(fi; 1 +] xeHnogard [srekcauq =] xeHnogard [srekcauq {od; 91 = xeHnogard margoloH; eslaf = re kcitSrepmub regrubseehCsaHnortageM {} eurt(elihw}; 0 =] sreppey [srekcauq {)++ sreppey; 02< sreppey; 0 = sreppey margoloH(rof;] 02 [margoloH wen = srekcauq] [margoloH {)sgra] [tneidarGionoroV(niaM diov citats

请注意,我已经反转了所有代码.我还删除了所有换行符和制表符,并用空格替换了它们.另外,我使用了使用NewName = OldNamespace.Oldtype;".将所有类型重命名为完全无法识别的类型(并且我没有在上面的代码中包括那些用法").如果您可以解密该代码,则说明您已经使用了一些解决问题的能力,并且我相信您将得到应有的解决方案.我相信您可以...您只需要决定要采取的路线即可:自行解决问题,或通过解密以上代码使用我的解决方案.编码愉快:)
For better or worse, here is your solution (a partial solution, which only prints the combinations for exactly 20 vowels, and which is written in C#):
} ;)(gnirtSoT.onhceTdaBgnortS nruter } ;))knidrepmuHtrebelgnI(eheheH(dneppA.onhceTdaBgnortS { )detraFgodrednU ni knidrepmuHtrebelgnI margoloH( hcaerof ;)htgneL.detraFgodrednU(niugnePAnOkcuDA wen = onhceTdaBgnortS niugnePAnOkcuDA { )detraFgodrednU ][margoloH(erocdraHtItaE tneidarGionoroV citats cilbup } ;]mun[staCfOsderdnuH nruter { )mun margoloH(eheheH tneidarGionoroV citats cilbup ;} "Y" ,"U" ,"O" ,"I" ,"E" ,"A" { = staCfOsderdnuH ][tneidarGionoroV citats etavirp } } } ;kaerb { )sgnihTetirovaFyMfOemoSerAesehT( fi } } ;kaerb ;eslaf = sgnihTetirovaFyMfOemoSerAesehT { )5 < i( fi { )srekcauq ni i margoloH( hcaerof ;eurt = sgnihTetirovaFyMfOemoSerAesehT regrubseehCsaHnortageM ;)"," + )srekcauq(erocdraHtItaE(etirW.tuO.elosnoC.metsyS ;)rekcitSrepmub( elihw } } ;eslaf = rekcitSrepmub { esle } ;--xeHnogard ;eurt = rekcitSrepmub ;0 = ]xeHnogard[srekcauq { )5 > ]xeHnogard[srekcauq( fi ;1 + ]xeHnogard[srekcauq = ]xeHnogard[srekcauq { od ;91 = xeHnogard margoloH ;eslaf = rekcitSrepmub regrubseehCsaHnortageM { )eurt( elihw } ;0 = ]sreppey[srekcauq { )++sreppey ;02 < sreppey ;0 = sreppey margoloH( rof ;]02[margoloH wen = srekcauq ][margoloH { )sgra ][tneidarGionoroV(niaM diov citats

Note that I have reversed all of the code. I have also removed all newline characters and tabs and replaced them with spaces. Also, I used "using NewName = OldNamespace.Oldtype;" to rename all types to a type that is completely unrecognizable (and I didn''t include those "usings" in the above code). If you can decipher that code, you have used some problem solving abilities and I am convinced that you will then deserve the solution. I''m sure you can... you just need to decide which route you want to take: solve the problem yourself, or use my solution by deciphering the above code. Happy coding :)


这是您入门的一项适中任务.如果您在处理它时遇到问题并尝试自己解决问题,则可以发布所做的事情以及遇到的问题.那时也许有人可以为您提供帮助.

您可以先获取条目(您已经编写了此条目)并检查其是否有效.接下来,您必须弄清楚如何完成这项工作.这有两部分-产生所有可能性并产生输出.我可以想到2种基本方法,一种是使用循环,另一种是递归.既然您还没有对自己计划如何做任何事情提出起诉,那么我真的无法再为您提供任何帮助.这是你的功课.您将必须考虑如何完成任务,提出计划并开始执行.开始作业后,您可能会在工作中遇到的问题寻求帮助.
This is a modest task for you to get started with. If you have problems when you are working on it and have tried to solve them yourself, you might post what you have done and what the problem is that you encountered. At that time someone may be able to help you.

You can start by getting the entry(you''ve already written this) and checking that it is valid. Next you have to figure out how to do the job. There are 2 parts to this - generating all the possibilities and producing the output. I can think of 2 basic approaches to this, one is using a loop and the other is recursive. Since you haven''t indicted anything about how you plan to do this, I can''t really help you any further. This is your homework. You''ll have to think about how to accomplish the task, come up with a plan, and start in on it. Once you have started on your homework, you may seek help on problems you encounter in your efforts.


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

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