代码中有什么问题? [英] what is the wrong in the code?

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

问题描述

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

namespace function_of_product
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("x=");
            Console.Write("y=");
            int x = int.Parse(Console.ReadLine());
            int y = int.Parse(Console.ReadLine());
            int tot = multi(x, y);
            Console.WriteLine("tot=" + res);
            Console.ReadKey();
        }
        static int multi(int x, int y);

        int res = x * y;
        Return (res);


    }
}

推荐答案

你在做什么



You are doing

Console.WriteLine("tot=" + res);





我认为上述声明中的res应为tot



之前





I think the res in the above statement should be tot

before

int res = x * y;





您的代码有很多问题,





There is a lot wrong with your code,

Console.Write("x=");
Console.Write("y=");
int x = int.Parse(Console.ReadLine());
int y = int.Parse(Console.ReadLine());





应该是





should be

Console.Write("x=");
int x = int.Parse(Console.ReadLine());

Console.Write("y=");
int y = int.Parse(Console.ReadLine());


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

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