File: example_c.result

package info (click to toggle)
ruby-erubis 2.7.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,260 kB
  • sloc: ruby: 8,758; ansic: 97; makefile: 72; php: 17
file content (32 lines) | stat: -rw-r--r-- 764 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$ erubis -l cpp example.ecpp
#line 1 "example.ecpp"

#include <string>
#include <iostream>
#include <sstream>

int main(int argc, char *argv[])
{
    std::stringstream _buf;

_buf << "<html>\n"
        " <body>\n"
        "  <p>Hello "; _buf << (argv[0]); _buf << "!</p>\n"
        "  <table>\n"
        "   <tbody>\n";
     for (int i = 1; i < argc; i++) { 
_buf << "    <tr bgcolor=\""; _buf << (i % 2 == 0 ? "#FFCCCC" : "#CCCCFF"); _buf << "\">\n"
        "      <td>"; _buf << (i); _buf << "</td>\n"
        "      <td>"; _buf << (argv[i]); _buf << "</td>\n"
        "    </tr>\n";
     } 
_buf << "   </tbody>\n"
        "  </table>\n"
        " </body>\n"
        "</html>\n";

    std::string output = _buf.str();
    std::cout << output;
    return 0; 
}