Visual Studio 2005创建C程序
在Visual Studio 2005中创建C程序的方法为:
1. File ->New Project -> Visual C++ -> Win32 -> Win32 Console Application,然后在下面的Name栏写上Project名称,Location栏写上文件的存放路径,点OK按钮进入Application Settings,在Addtional options中选择Empty project,点Finish按钮完成工程的创建。
2. 在visual studio 视图的右上角的Solution Explorer中,在Source Files中创建c程序,step为:右键点击Source Files,在menu中选择Add-> New Item,选择C++ File,并在下面的Name处键入first.c,location处写上程序名称和程序的位置,这里选默认即步骤1创建的工程位置,点Add按钮完成文件在Project中的添加。
3.程序写好后,先编译文件(Build-> Compile或ctrl+F7),再运行(Debug -> Start Without Debugging或ctrl+F5),就会看到所写程序的运行result.
附:1个最简单的C程序,hoho
first.c
/* 在屏幕上输出字符串 */
#include <stdio.h>
main()
{
printf("Hello,World!\n");
}
相关文档:
好久以前做的一个程序,贪心策略实现背包问题,c实现。
总结在这里,以备以后和别人查找。
//背包问题
#include "stdio.h"
#define MAX 10
void main()
{
int w[MAX]={0,10,130,15,60,25}; //存放质量
int v[MAX]={0,30,5,10,20,25}; //存放价值
flo ......
例) 危険なコーディング
1 char cStr[256];
2 ZeroMemory(cStr, sizeof(cStr));
3 &nb ......
C/C++ Reference
http://www.cppreference.com/
C++ Library Reference
http://www.cplusplus.com/ref/
Standard C++ Library Class Reference at Rogue Wave
http://www.roguewave.com/support/docs/hppdocs/stdref/
Dink ......
1. 怎样建立和理解非常复杂的声明?例如定义一个包含N 个指向返回指向字符的指针的函数的指针的数组?
这个问题至少有以下3 种答案:
1. char *(*(*a[N])())();
2. 用typedef 逐步完成声明:
typedef char *pc; /* 字符指针*/
typedef pc fpc(); /* 返回字符指针的函数*/
typedef fpc *pfpc; /* 上面函数的指针*/ ......
C/C++
头文件一览
//////////////////////////////////////////////////////////////////////////
C
头文件
(C89,C95)
(C++98,C++03也包含)
include <assert.h> //诊断库
include <ctype.h> //字符处理函数库
include <errno.h> //错误定义
include <float.h& ......