14-题目1065:输出梯形

来源:互联网 发布:tears and rain 知乎 编辑:程序博客网 时间:2024/06/13 07:09

http://ac.jobdu.com/problem.php?pid=1065

题目描述:

输入一个高度h,输出一个高为h,上底边为h的梯形。

//14-题目1065:输出梯形#include<stdio.h>  #include<iostream> #include <fstream>using namespace std;int main(){int h, i, j;//ifstream cin("data.txt");while (cin >> h){for (i = 1; i <= h; i++){for (j = 0; j < 2 * (h - i); j++)cout << " ";for (j = 0; j < h + 2 * (i - 1); j++)cout << "*";cout << endl;}}//system("pause");return 0;}


0 0