close

#include<stdlib.h>
#include<stdio.h>
int OutputOblong(int w , int h);
int main()
{
    OutputOblong(9,8);  //範例1
    OutputOblong(18,5); //範例2
    OutputOblong(26,6); //範例3
    system("pause");
    return 0;
}

int OutputOblong(int w , int h)
{
    int i,j;
    for(i=1;i<=h;i++){
        for(j=1;j<=w;j++){
            if(i==1||i==h)
                printf("*");
            else
                printf((j==1||j==w)?"*":" ");
        }
        printf("n");
    }
    printf("n");

http://tw.knowledge.yahoo.com/question/question?qid=1206110904785


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 chph 的頭像
    chph

    Afutseng's Blog

    chph 發表在 痞客邦 留言(0) 人氣()