如何使用char在控制台应用程序中绘制形状 [英] How do I use char to draw shapes in a console application

查看:81
本文介绍了如何使用char在控制台应用程序中绘制形状的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我是学生,不得不做几个练习,但我坚持这个练习。



我必须写一个使用符号o打印心形图形的程序。但我不知道怎么做。



我尝试过的事情:



我试过谷歌和MSDN,但找不到解决方案。

Hi all, I'm a student and have to do a couple of exercises, but I'm stuck on this one.

I have to write a program that print a figure in the shape of a heart by using the sign "o". But I have no idea how to do it.

What I have tried:

I have tried google and MSDN, but could not find a solution.

推荐答案

Quote:

如何使用char在控制台应用程序中绘制形状

How do I use char to draw shapes in a console application



实际上,在控制台应用程序中,所有形状都是位图并使用至少2个字符显示形状。

对于任何形状,你必须对它进行编码,基本上有两个选项:

- 你可以使用数学属性,你可以用代码对形状进行编码专门为这种形状。正方形,矩形,三角形,菱形...

- 你不能使用数学属性,你必须将形状编码为数据并编写一些代码来显示形状。任何形状都不适合第一类。

这是你的作业,你必须编写代码。



作为程序员, 你的工作是创建解决特定问题的算法,你不能依赖别人为你永远做到这一点,所以有一段时间你必须学会​​如何做。而且越快越好。

当你要求解决方案时,就像试图通过培训其他人来学习开车一样。

创建算法基本上是找到数学并做出必要的调整以适应你的实际问题。



发展的概念就像这个词所暗示的那样:系统地使用科学和满足特定目标或要求的技术知识。 BusinessDictionary.com [ ^ ]

这与有一个不一样快速谷歌并放弃,如果我找不到正确的代码。


In practice, in a console app, all shapes are bitmaps and use at least 2 chars to show shapes.
For any shape, you have to encode it, and there is basically 2 options:
-You can use mathematical properties and you can encode the shape in code specialized for this shape. square, rectangle, triangle, diamond ...
-You can't use mathematical properties and you have to encode the shape as data and write some code to display the shape. Any shape that don't fit in first category.
This is your homework, you have to write the code.

As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
When you just ask for the solution, it is like trying to learn to drive a car by having someone else training.
Creating an algorithm is basically finding the maths and make necessary adaptation to fit your actual problem.

The idea of "development" is as the word suggests: "The systematic use of scientific and technical knowledge to meet specific objectives or requirements." BusinessDictionary.com[^]
That's not the same thing as "have a quick google and give up if I can't find exactly the right code".


这篇关于如何使用char在控制台应用程序中绘制形状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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