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(" ");
        }
    }
    豪情壮志铁傲骨,原来英雄是孤独。
  • 相关阅读:
    十六进制转十进制
    十进制转十六进制
    历届试题 高僧斗法
    历届试题 错误票据
    历届试题 大臣的旅费
    历届试题 九宫重排/八数码问题
    Skip the Class
    历届试题 剪格子
    leetcode 337. House Robber III
    猿辅导 2019年 校招提前批笔试
  • 原文地址:https://www.cnblogs.com/xwoder/p/4488551.html
Copyright © 2011-2022 走看看