动态 版块 发帖 消息 我的
小绿叶技术博客
小绿叶技术博客
小绿叶技术Lv150   
打印三角形 C++ web编程     


#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;
}










 0  已被阅读了119次  楼主 2022-12-21 13:34:43
回复列表

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

guest
登录之后更精彩~
Powered by HadSky 7.7.16
© 2015-2023 PuYueTian
您的IP:8.219.134.200,2023-02-01 15:49:24,Processed in 0.00803 second(s).
Powered by HadSky
小绿叶技术博客