根据输入给出输出. [英] Give output based on input.

查看:75
本文介绍了根据输入给出输出.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我在使用变量以及输入和输出时遇到了麻烦.

Well i am having trouble with variables and inputs and outputs.

当人击中s时,我要写我的陈述我不喜欢运动,但是足球很好".我也想为g和i做它.我刚刚开始学习,我在尝试从特定输入中获取特定输出时遇到了麻烦. 是我到目前为止所拥有的

When the person hits s i want it to write my statement "i dont like sports much but football is nice". I also want to do it for g and i. im just starting to learn and Im having trouble trying to get the specific output from the specific input. This is what i have so far

推荐答案

您会丢失Console.ReadKey()(除非您在发布代码时遇到问题,因为您已经编写了Console.点后没有任何内容.)您应该具有以下内容:

You're missing the Console.ReadKey() (unless you had a problem when you posted your code, since you have written Console. with nothing after the dot.) You should have something like this:

ConsoleKeyInfo keyInfo = Console.ReadKey();
if (keyInfo.KeyChar == 's' || keyInfo.KeyChar == 'S')
{
     Console.WriteLine("I don't like sports much but football is nice to watch. I dont really like to play sports");
}



这篇关于根据输入给出输出.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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