热度 1006| |
各位网友大家好,在eetop技术团队的努力下,我们的编辑器现在可以支持各种计算机语言的格式化和高亮了,欢迎大家使用
使用方法为:在编辑器第二排右侧点击“代码语言”后会出现下拉框,然后选择相应的语言后,会在编辑器中出现灰色语言框,然后在框里输入相应语言的代码即可,下面是我写的一个c++的例子
#include <iostream> using namespace std; #include <iomanip> using std::setw; int main (){ int n[ 10 ]; // n 是一个包含 10 个整数的数组 // 初始化数组元素 for ( int i = 0; i < 10; i++ ) { n[ i ] = i + 100; // 设置元素 i 为 i + 100 } cout << "Element" << setw( 13 ) << "Value" << endl; // 输出数组中每个元素的值 for ( int j = 0; j < 10; j++ ) { cout << setw( 7 )<< j << setw( 13 ) << n[ j ] << endl; } return 0; }
再给一个verilog测试代码
/******************************************************************************* * * * mux2x1 - 2:1 mux * mux322x1 32 bit wide 2:1 mux * or2 - 2 bit or gate * or2x4 - 2 bit or with 4x drive * or28x2 - 8 bit wide 2 bit or with 2x drive * invx4 - inverter with 4x drive * bufxa - buffer with a drive * *****************************************************************************/ module dffr (q,d,clk,rstn); input d,clk,rstn; output q; reg q; always @(posedge clk or negedge rstn) begin if (rstn == 1'b0) q <= 1'b0; else q <= d; end // always @ (posedge clk or negedge rstn) endmodule // dffr