fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <cmath>
  4. #include <fstream>
  5. #include <stdio.h>
  6.  
  7. //#pragma warning(disable:4996) //汚い・・・。Orz
  8.  
  9. std::string MakeHeader(){
  10. std::string str;
  11.  
  12. str = "<head>";
  13. str += "<title>こんなんでいいんですかね??</title>";
  14. str += "</head>";
  15.  
  16. return str;
  17. }
  18. std::string MakeBody(){
  19. std::string str;
  20. char Buf[1024];
  21.  
  22. str = "<body>";
  23.  
  24. for (int i = 0; i < 180; i++){
  25. str += "<hr width=\"";
  26. std::sprintf(Buf, "%d", static_cast<int>(100 * std::sin((i)*(3.1415926463 / 180.0))));
  27. str += Buf;
  28. //str += _itoa(static_cast<int>(100*std::sin((i - 45)*(3.1415926463 / 180.0))), Buf, 10);
  29. str +="\">";
  30. str += "\n";
  31. }
  32.  
  33. str += "</body>";
  34.  
  35. return str;
  36. }
  37.  
  38. std::string CreateHTML(){
  39. std::string str;
  40.  
  41. str = "<html>";
  42. str += MakeHeader();
  43. str += MakeBody();
  44. str += "</html>";
  45.  
  46. return str;
  47. }
  48.  
  49. bool Write(std::ostream& os, std::string& str){
  50. os << str;
  51. return true;
  52. }
  53.  
  54. int main(){
  55. std::string str = CreateHTML();
  56. std::ofstream ofs("hoge.html");
  57.  
  58. Write(std::cout, str);
  59. //Write(ofs,str);
  60.  
  61. return 0;
  62.  
  63. }
Success #stdin #stdout 0s 3432KB
stdin
Standard input is empty
stdout
<html><head><title>こんなんでいいんですかね??</title></head><body><hr width="0">
<hr width="1">
<hr width="3">
<hr width="5">
<hr width="6">
<hr width="8">
<hr width="10">
<hr width="12">
<hr width="13">
<hr width="15">
<hr width="17">
<hr width="19">
<hr width="20">
<hr width="22">
<hr width="24">
<hr width="25">
<hr width="27">
<hr width="29">
<hr width="30">
<hr width="32">
<hr width="34">
<hr width="35">
<hr width="37">
<hr width="39">
<hr width="40">
<hr width="42">
<hr width="43">
<hr width="45">
<hr width="46">
<hr width="48">
<hr width="49">
<hr width="51">
<hr width="52">
<hr width="54">
<hr width="55">
<hr width="57">
<hr width="58">
<hr width="60">
<hr width="61">
<hr width="62">
<hr width="64">
<hr width="65">
<hr width="66">
<hr width="68">
<hr width="69">
<hr width="70">
<hr width="71">
<hr width="73">
<hr width="74">
<hr width="75">
<hr width="76">
<hr width="77">
<hr width="78">
<hr width="79">
<hr width="80">
<hr width="81">
<hr width="82">
<hr width="83">
<hr width="84">
<hr width="85">
<hr width="86">
<hr width="87">
<hr width="88">
<hr width="89">
<hr width="89">
<hr width="90">
<hr width="91">
<hr width="92">
<hr width="92">
<hr width="93">
<hr width="93">
<hr width="94">
<hr width="95">
<hr width="95">
<hr width="96">
<hr width="96">
<hr width="97">
<hr width="97">
<hr width="97">
<hr width="98">
<hr width="98">
<hr width="98">
<hr width="99">
<hr width="99">
<hr width="99">
<hr width="99">
<hr width="99">
<hr width="99">
<hr width="99">
<hr width="99">
<hr width="100">
<hr width="99">
<hr width="99">
<hr width="99">
<hr width="99">
<hr width="99">
<hr width="99">
<hr width="99">
<hr width="99">
<hr width="98">
<hr width="98">
<hr width="98">
<hr width="97">
<hr width="97">
<hr width="97">
<hr width="96">
<hr width="96">
<hr width="95">
<hr width="95">
<hr width="94">
<hr width="93">
<hr width="93">
<hr width="92">
<hr width="92">
<hr width="91">
<hr width="90">
<hr width="89">
<hr width="89">
<hr width="88">
<hr width="87">
<hr width="86">
<hr width="85">
<hr width="84">
<hr width="83">
<hr width="82">
<hr width="81">
<hr width="80">
<hr width="79">
<hr width="78">
<hr width="77">
<hr width="76">
<hr width="75">
<hr width="74">
<hr width="73">
<hr width="71">
<hr width="70">
<hr width="69">
<hr width="68">
<hr width="66">
<hr width="65">
<hr width="64">
<hr width="62">
<hr width="61">
<hr width="60">
<hr width="58">
<hr width="57">
<hr width="55">
<hr width="54">
<hr width="52">
<hr width="51">
<hr width="50">
<hr width="48">
<hr width="46">
<hr width="45">
<hr width="43">
<hr width="42">
<hr width="40">
<hr width="39">
<hr width="37">
<hr width="35">
<hr width="34">
<hr width="32">
<hr width="30">
<hr width="29">
<hr width="27">
<hr width="25">
<hr width="24">
<hr width="22">
<hr width="20">
<hr width="19">
<hr width="17">
<hr width="15">
<hr width="13">
<hr width="12">
<hr width="10">
<hr width="8">
<hr width="6">
<hr width="5">
<hr width="3">
<hr width="1">
</body></html>