收藏文章 楼主

打印三角形 C++ web编程

版块:c++ web 编程   类型:普通   作者:小绿叶技术博客   查看:1611   回复:0   获赞:0   时间:2022-12-21 13:34:43


#include <iostream>
#include <vector>  
#include <string>  
#include <stdio.h>  
#include <stdlib.h> 
 
#include <cgicc/CgiDefs.h> 
#include <cgicc/Cgicc.h> 
#include <cgicc/HTTPHTMLHeader.h> 
#include <cgicc/HTMLClasses.h>  
 
using namespace std;
using namespace cgicc;




int main ()
{
   Cgicc formData;
   
   cout << "Content-type:text/html;charset=utf-8\n\n";
// 告诉浏览器字符编码

   cout << "<html>\n";
   cout << "<head>\n";
   cout << "<title> C++ web 编程</title>\n";
   cout << "</head>\n";
   cout << "<body>\n";


    int space, rows;
 
    cout <<"打印三角形: <br/>";
//    cin >> rows;
    rows=7;
 
    for(int i = 1, k = 0; i <= rows; ++i, k = 0)
    {
        for(space = 1; space <= rows-i; ++space)
        {
            cout <<"&nbsp";
        }
 
        while(k != 2*i-1)
        {
            cout << "*";
            ++k;
        }
        cout << "<br/>";
        cout << endl;
    }    
    return 0;
}










提供企业建站服务,免费网防系统,提交信息登录 http://yundun.ddoss.cn 邮箱: proposal@ddoss.cn 
回复列表
默认   热门   正序   倒序

回复:打印三角形 C++ web编程

头像

用户名:

粉丝数:

签名:

资料 关注 好友 消息