主题:C语言讨论区支持代码着色功能,欢迎试用并提意见
yaozheng
[专家分:28410] 发布于 2007-05-17 23:15:00
支持C/C++语法及大部分函数的着色,使用方法:
在需要贴代码的地方,在代码前后加上如下标签:
[b][[/b][b]code=c[/b][b]][/b]
您的代码
[b][[/b][b]/code[/b][b]][/b]
着色演示:
[code=c]
#include "stdio.h"
main()
{
int a[ 100] , n , i , j , t ;
scanf("%d", &n) ;
for( i=1 ; i<=n ; i++)
scanf("%d", &a[i]) ;
for( j=1; j<=n-1; j++)
for( i=1 ; i<=n-j ; i++)
if (a[i]>a[i+1])
{
t=a[i]; a[i]=a[i+1]; a[i+1]=t;
}
for( i=1 ; i<=n ; i++)
printf("%d ", a[i] );
}
[/code]
欢迎大家多提意见!谢谢大家!
回复列表 (共29个回复)
21 楼
iAkiak [专家分:8460] 发布于 2007-05-26 17:17:00
再试试
[code=c]
/* commented codes
char *s = "Hi, I'm string. Say,\" nothing\". ";
// */
int main()
{
return 0;
}
[/code]
22 楼
chxchx [专家分:0] 发布于 2007-06-09 00:03:00
试试
[code=c]
#include <stdio.h>
int main()
{
for(;;)
{
char num[101];//="0000000000";
int nc, ni=0, t;
while(ni<=100)num[ni++]=0;
}
return 0;
}
[/code]
23 楼
vfdff [专家分:740] 发布于 2007-08-07 13:56:00
[code=c]
#include "stdio.h"
main()
{ FILE *fp;
char str[100],filename[10];
int i=0;
if((fp=fopen("test","w"))==NULL)
{printf("cannot open the file\n"); exit(0);}
printf("please input a string:\n");
gets(str);
while(str[i]!='!')
{if(str[i]>='a'&&str[i]<='z')
str[i]=str[i]-32; /*小写到大写转换*/
fputc(str[i],fp); /*将改后符合要求的字符一个个送入流中*/
i++;
}
fclose(fp);
fp=fopen("test","r"); /*验证正确转换*/
fgets(str,strlen(str)+1,fp);/*第strlen(str)+1个字符为'\0',为字符结束标志*/
printf("%s\n",str);
fclose(fp);
}
[/code]
24 楼
vfdff [专家分:740] 发布于 2007-08-07 13:57:00
哇,真的可以呀 ?不知道这个功能怎么实现的 ?
25 楼
冷夜月 [专家分:910] 发布于 2007-09-14 09:34:00
随便拷点代码来试试
[code=c]
class CPenDC
{
protected:
CPen m_pen;
HDC m_hDC;
HPEN m_hOldPen;
public:
CPenDC (HDC hDC, COLORREF crColor = CLR_NONE);
~CPenDC ();
void Color (COLORREF crColor);
COLORREF Color () const;
};
CPenDC::CPenDC (HDC hDC, COLORREF crColor) : m_hDC (hDC)
{
VERIFY(m_pen.CreatePen (PS_SOLID, 1, crColor));
m_hOldPen = (HPEN)::SelectObject (m_hDC, m_pen);
}
///////////////////////////////////////////////////////////////////////////////
CPenDC::~CPenDC ()
{
::SelectObject (m_hDC, m_hOldPen);
}
///////////////////////////////////////////////////////////////////////////////
void CPenDC::Color (COLORREF crColor)
{
::SelectObject (m_hDC, m_hOldPen);
VERIFY(m_pen.DeleteObject());
VERIFY(m_pen.CreatePen (PS_SOLID, 1, crColor));
m_hOldPen = (HPEN)::SelectObject (m_hDC, m_pen);
}
///////////////////////////////////////////////////////////////////////////////
COLORREF CPenDC::Color () const
{
LOGPEN logPen;
((CPenDC*)this)->m_pen.GetLogPen (&logPen);
return logPen.lopnColor;
}
[/code]
26 楼
286850875 [专家分:100] 发布于 2007-09-19 18:14:00
[em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10][em10]
27 楼
oopos [专家分:0] 发布于 2007-10-09 08:07:00
[code=c]
#include <stdio.h>
int main(void)
printf("还可以,不过还有很多BUG...\n"); // 这是注释
/*这还是注释*/
return 0;
}
[/code]
28 楼
oopos [专家分:0] 发布于 2007-10-09 08:09:00
很明显:
这个
[code=c]
//"00000"
/*"00000"*/
[/code]
应该是这样子的:
//"00000"
所以说:注释掉的内容,就要归另类处理
29 楼
nily999 [专家分:0] 发布于 2010-08-01 20:38:00
[url=http://www.newhotshoes.com]Christian louboutin [/url]
[url=http://www.newhotshoes.com/]christian louboutin sale[/url]
[url=http://www.newhotshoes.com/christian-louboutin-news-2010-c-54.html]christian louboutin shoes[/url]
[url=http://www.newhotshoes.com/]sale christian louboutin[/url]
[url=http://www.usachristianlouboutin.com/]Christian louboutin [/url]
[url=http://www.usachristianlouboutin.com/]christian louboutin discount[/url]
[url=http://www.usachristianlouboutin.com/]Christian Louboutin Pumps[/url]
[url=http://www.newhotshoesaleristian-louboutin-dorsays-c-52.html]Christian Louboutin d'Orsays[/url]
[url=http://www.newhotshoes.com/]Christian Louboutin Boots[/url]
[url=http://www.usachristianlouboutin.com/]Christian Louboutin Pumps[/url]
[url=http://www.newhotshoes.com/christian-louboutin-sandals-c-40.html]Christian Louboutin Sandals[/url]
[url=http://www.newhotshoes.com/christian-louboutin-shoes-c-38.html]Christian Louboutin Shoes[/url]
[url=http://www.usachristianlouboutin.com]Christian Louboutin Slingback[/url]
[url=http://www.newhotshoes.com/christian-louboutin-wedges-c-39.html]Christian Louboutin Wedges[/url]
[url=http://www.newhotshoes.com/giuseppe-zanotti-shoes-c-53.html]Giuseppe Zanotti Shoes[/url]
[url=http://www.usachristianlouboutin.com/jimmy-choo-shoes-c-41.html]Jimmy Choo Shoes[/url]
[url=http://www.newhotshoes.com/manolo-blahnik-c-43.html]Manolo Blahnik[/url]
[url=http://www.newhotshoes.com/manolo-blahnik-boots-c-46.html]Manolo Blahnik Boots[/url]
[url=http://www.newhotshoes.com/manolo-blahnik-slingback-c-47.html]Manolo Blahnik slingback[/url]
[url=http://www.newhotshoes.com/sergio-rossi-c-55.html]Sergio Rossi[/url]
[url=http://www.newhotshoes.com/yves-saint-laurent-c-42.html]Yves Saint Laurent[/url]
[url=http://www.newhotshoes.com/alexander-wang-c-56.html]Alexander Wang [/url]
Why do women love [URL=http://www.usachristianlouboutin.com/]christian louboutin [/URL]PUMPS? Why obsession the world of [URL=http://www.usachristianlouboutin.com]christian louboutin discount[/URL]pumps? Perhaps because christian louboutin shoes shaped women's posture; perhaps because
[URL=http://www.newhotshoes.com]christian louboutin shoes[/URL] given women the magic of rebirth.you may choose christian louboutin!!!!
我来回复