C++と色々

主にC++やプログラムに関する記事を投稿します。

ソースコード貼るテスト

約5ヶ月ぶりの更新 ソースコードを貼るテスト

<pre>タグで貼ってみる


#include
#include
using namespace std;

int main()
{
function f = [](int i){ return i * i; };
cout << f(3) << endl;
return 0;
}


>||と||<で貼ってみる

#include <iostream>
#include <functional>
using namespace std;

int main()
{
	function<int (int)> f = [](int i){ return i * i; };
	cout << f(3) << endl;
	return 0;
}


色を付けたい。>|cpp|と書いてみた。

#include <iostream>
#include <functional>
using namespace std;

int main()
{
	function<int (int)> f = [](int i){ return i * i; };
	cout << f(3) << endl;
	return 0;
}


ちなみに>|c|と書くと…

#include <iostream>
#include <functional>
using namespace std;

int main()
{
	function<int (int)> f = [](int i){ return i * i; };
	cout << f(3) << endl;
	return 0;
}


using namespaceの色がなくなった。ソースの貼り方が分かったので、更新できるといいなぁ


※おまけ
>|java|

import java.io.*;

class Test
{
	public static void main(String args[])
	{
		System.out.println("Hello World!");
	}
}

>|html|

<html>
<head><title>test</title></head>
<body>
<p>hello!</p>
<?php
$str = "Hello World!\n";
print $str;
?>
<br>
</body>
</html>

>|php|

<html>
<head><title>test</title></head>
<body>
<p>hello!</p>
<?php
$str = "Hello World!\n";
print $str;
?>
<br>
</body>
</html>