这是否编程任务是有意义的吗? [英] Does this programming assignment make sense to you?

查看:445
本文介绍了这是否编程任务是有意义的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个朋友来找我对他的任务的建议。
但我继续回来同样的事情,问题是有缺陷的 - 输入没有意义的输出示例
。 我不希望有一个解决问题的办法,只看到如果有人不同意这个没有意义。

  

编写一个程序,读取任何包含四个文件数据   正数,每一个单独的行,第三个数字是少   比第二和第四个数字是单个数字。

     

首先两个数重新present的一个的高度和宽度(行和列)   使用点生成的矩形(。)。

     

第三个数字再presents之间的()在矩形的每行一个反复出现的下划线。

     

第四个数字将被用于衬垫的矩形与其自身(见   下面的例子),以下划线在两者之间,多次,因为它是   需要垫整个矩形

示例文件将

  5
8
3
2
 

和输出示例将

  2_2_2_2_2
2 _.._.._.._ 2
2 _.._.._.._ 2
2 _.._.._.._ 2
2 _.._.._.._ 2
2 _.._.._.._ 2
2_2_2_2_2
 

解决方案

的例子说明:
构建具有5×8点的矩形,并替换每3点带下划线

  .._.._ ..
.._.._ ..
.._.._ ..
.._.._ ..
.._.._ ..
 

在这之后,填充它与 2 _ _2
什么是不清楚的吗?

A friend came to me for advice on his assignment.
But I keep coming back to the same thing, the question is flawed - the input doesn't make sense in the output example.
I don't want a solution to the problem, just seeing if anyone agrees it doesn't make sense.

Write a program that reads from a file data containing any four positive numbers, each on a separate line, third number being less than the second and fourth number being a single digit.

First two numbers represent the height and width (rows and columns) of a rectangle generated using dots (.).

The third number represents a recurring underscore among the (.) on each row of the rectangle.

The fourth number will be used to pad the rectangle with itself (see example below), with an underscore in-between, as many times as it is needed to pad the entire rectangle.

Example file would be

5
8
3
2

And example output would be

2_2_2_2_2
2_.._.._.._2
2_.._.._.._2
2_.._.._.._2
2_.._.._.._2
2_.._.._.._2
2_2_2_2_2

解决方案

Explanations of the example:
Build 5x8 rectangle with dots and substitute every 3rd dot with underscore

.._.._..
.._.._..
.._.._..
.._.._..
.._.._..

After that, pad it with 2_ and _2
What is unclear?

这篇关于这是否编程任务是有意义的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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