我的代码对于下面的问题是否正确?请帮我 [英] is my code for the below question correct? please help me

查看:60
本文介绍了我的代码对于下面的问题是否正确?请帮我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从输入到输出重写小数字。读取数字42后停止处理输入。输入的所有数字都是一位或两位数的整数。



例子



输入:

1

2

88

42

99



输出:

1

2

88



rewrite small numbers from input to output. Stop processing input after reading in the number 42. All numbers at input are integers of one or two digits.

Example

Input:
1
2
88
42
99

Output:
1
2
88

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter the range and numbers:");
            int n=Int32.Parse(Console.ReadLine);
            int a[n]=Int32.Parse(Console.ReadLine);
            do{
                n=0;
                Console.Write(_a[n]);
                n++;
            }while(a[n]!=42);
        }
    }
}

推荐答案

否。



如果您不确定您的应用是否符合您的要求,请运行它! (最好在调试器中,这样你就可以看到发生了什么。)



这个问题要求你从用户那里读取数字并再次打印出来,直到他进入42你的代码没有这样做。如果你运行它,你会看到它做了什么。



这是一项技能:它被称为调试,唯一能够做到这一点的方法是实践。当你确实擅长它时,你会发现现实生活中也有同样的过程......所以值得一试!
No.

If you aren't sure if your app does what you want, run it! (Preferably in the debugger so you can watch what is happening.)

The question asks you to read numbers from the user and print them out again, until he enters 42. Your code doesn't do that. And if you run it, you will see what it does do.

This is a skill: it's called debugging, and the only way to get good at it is to practice. And when you do get good at it, you will find the same processes work in real life too...so it's worth getting the hang of!


这篇关于我的代码对于下面的问题是否正确?请帮我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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