有人知道怎么做吗? [英] Does someone know how to make this?

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

问题描述

TekstMaker tm = new TekstMaker();
tm.VoegToe("Hallo", 1);
tm.VoegToe("1234567890", 0);
tm.VoegToe("!!", 10);
Console.Out.WriteLine(tm);





控制台显示:





console shows:

Hallo !! !! !! !! !! !! !! !! !! !! ‐ aantal toevoegingen: 2 ‐ lengte: 36





我的尝试:



我试过这个,但它没有做任何事情......





What I have tried:

I have tried this, but it doesn't do anything..

class Program
    {
        public string Voegtoe(string invoertekst, int aantalkeer)
        {
            Console.WriteLine(invoertekst = "");
            return new String('\t', aantalkeer);
        }

        static void Main(string[] args)
        {
            Program tm = new Program();
            tm.Voegtoe("hoi", 5);
            Console.Out.WriteLine();
            Console.ReadLine();
        }
    }
}

推荐答案

你忘了告诉WriteLine写任何东西!添加 tm

You forgot to tell WriteLine to write anything! Add tm:
tm.Voegtoe("hoi", 5);
Console.Out.WriteLine(tm);


这篇关于有人知道怎么做吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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