C/C++(hello world)

#include <windows.h>//系统会自动连接到指定的库文件lib
#include <stdio.h>//std  io  标准输入输出接口

int main()
{
	int select = ::MessageBox(NULL,"hello world","caption",MB_OKCANCEL);//::是全局函数
	if(select == IDOK)
	{
		printf("aaa");
	}
	else
	{
		printf("bbb");
	}
	return 0;
}

使用vs.net2008写C程序

可以创建C++项目

选择Win32 控制台应用程序,

在应用程序窗口选择空项目复选框,

然后在建好解决方案中添加C++ 文件(.cpp),

把文件名写成.c扩展名的。

创建完毕后,右击.c文件,

选择属性->高级->编译为C代码(/TC)即可。

posted @ 2010-02-04 14:31  liulun  阅读(492)  评论(2编辑  收藏  举报