zoukankan      html  css  js  c++  java
  • [HDOJ]_2052_Picture

    题目:

    Problem Description
    Give you the width and height of the rectangle,darw it.
    
    Input
    Input contains a number of test cases.For each case ,there are two numbers n and m (0 < n,m < 75)indicate the width and height of the rectangle.Iuput ends of EOF.
    
    Output
    For each case,you should draw a rectangle with the width and height giving in the input.
    after each case, you should a blank line.
    
    Sample Input
    3 2
    
    Sample Output
    +---+
    |   |
    |   |
    +---+
    
    Author
    xhd
    
    Source
    校庆杯Warm Up
    
    Recommend
    linle

    代码:

    #include <stdio.h>
    
    void horizontal(unsigned int);
    void space(unsigned int);
    
    int main(void) {
        unsigned int n, m, i;
        while (scanf("%u %u", &n, &m) != EOF) {
            printf("+");
            horizontal(n);
            printf("+
    ");
            
            for (i = 0; i < m; ++i) {
                printf("|");
                space(n);
                printf("|
    ");
            }
            
            printf("+");
            horizontal(n);
            printf("+
    
    ");
        }
        return 0;
    }
    
    void horizontal(unsigned int n) {
        for (unsigned int i = 0; i < n; ++i) {
            printf("-");
        }
    }
    
    void space(unsigned int n) {
        for (unsigned int i = 1; i <= n; ++i) {
            printf(" ");
        }
    }
    豪情壮志铁傲骨,原来英雄是孤独。
  • 相关阅读:
    软件工程结对作业
    软件工程第二次作业
    软件工程第一次作业
    MATLAB安装教程
    实现生成小学四则运算练习题
    结对编程-审查代码
    软件第三次作业
    练习使用Eclipse进行单元测试
    软件工程第一次作业
    Visual Studio Code (vscode)
  • 原文地址:https://www.cnblogs.com/xwoder/p/4488551.html
Copyright © 2011-2022 走看看