visual c++怎么用c语言编程?步骤具体点。。。多谢

来源:百度知道 编辑:UC知道 时间:2024/06/15 07:46:35

你是想问怎么样用VC++编译C语言?
新建->选Win32 Console Application(并把位置和工程名填写好)->
选A simple Application->按完成->双击打开class view中的main->
在#include "stdafx.h"的下一行加入#include<stdio.h>

附:
可以把int main(int argc, char* argv[])删成main();和删除return 0;但不删除也没有关系.

c语言编程同常规c语言一样。不必建工程。用文本编辑写程序就可以了。

例如,已知a=1,b=2,计算c=a+b:
用记事本 notepad 编写程序 my_prog.c 如下

#include <stdio.h>
#include <stdlib.h>
void main()
{
int a,b,c;
a=1;
b=2;
c = a + b;
printf("a=%d b=%d c=a+b=%d\n",a,b,c);
}

在DOS窗打编译命令:
CL my_prog.c
就得到可执行程序 my_prog.exe

屏幕上会显示编译器和链接器的版本信息,例如:
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

CL 命