博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Learning Cpp----Comliling your first program
阅读量:4561 次
发布时间:2019-06-08

本文共 1418 字,大约阅读时间需要 4 分钟。

IDE: Visual Studio 2008

Project Type: Console Application

 

Point 1:the first program is "Hello world" for a new language

Traditionally, the first program programmers write in a new language is the infamous , and we aren’t going to deprive you of that experience! You’ll thank us later. Maybe.The fact is very funny! The code is following:

 

#include "stdafx.h"#include 
using namespace std;int _tmain(int argc, _TCHAR* argv[]){ cout <<"Hello World!" <

 

Point 2: about "stdafx.h"

Important note to Visual Studio users: Visual studio programs should ALWAYS begin with the following line:

#include "stdafx.h"

Otherwise you will receive a compiler warning, such as c:\test\test.cpp(21) : fatal error C1010: unexpected end of file while looking for precompiled header directive.

Alternately, you can turn off precompiled headers. However, using precompiled headers will make your program compile much faster, so we recommend leaving them on 

unless you are developing a cross-platform program.

Point 3: about "iostream.h"

This header file privide the input/output methods for console programming:

input:cin

output:cout

for example:

#include "stdafx.h"#include 
using namespace std;int _tmain(int argc, _TCHAR* argv[]){ int x = 0; cout <<"Enter one integer:"; cin >> x; cout <<"The integer you entered is:" << x << endl; return 0;}

 

 

 

 

转载于:https://www.cnblogs.com/fangmei/archive/2010/12/23/1914553.html

你可能感兴趣的文章
pyqt 自定义信号
查看>>
多任务--进程 及 进程间通信
查看>>
多线程/多进程+QProgressBar实现进度条
查看>>
多任务(进程)案例----- 拷贝文件夹
查看>>
Kotlin的快速入门
查看>>
python 虚拟环境的 安装与 使用 和修改为豆瓣源
查看>>
js 快速入门
查看>>
Python 中的GIL
查看>>
如何解决ASCII 字符显示不出来的情况
查看>>
制表符 \t 的用法
查看>>
断点模式
查看>>
Ubuntu 侧边栏和顶栏设置
查看>>
底层原理
查看>>
21. Merge Two Sorted Lists
查看>>
shiro设置加密算法源码解析
查看>>
第二次冲刺
查看>>
实验四
查看>>
win8.1镜像制作
查看>>
Windows 服务开发框架介绍 - Topshelf
查看>>
php,字符串(二)
查看>>