第一个控制台程序,基本格式

 1 // WC1.cpp : Defines the entry point for the console application.
 2 //
 3 
 4 #include "stdafx.h"
 5 #include <iostream> //输入输出库
 6 
 7 //using namespace std;  
 8 
 9 int _tmain(int argc, _TCHAR* argv[])
10 {
11         
12     {
13         using namespace std;               //命名空间,作用域在大括号内,使用标准库
14         cout<<"hello world!\n"<<endl;  
15         wcout<<_T("hello world!\n")<<endl;   //unicode 宽字符
16          
17     }
18     
19     std::cout<<"hello world!\n"<<std::endl;   // 两种换行都可以
20 
21     system("pause");   //暂停 system函数在 stdlib.h 中定义,预编译标准头文件中已经包含
22 
23     return 0;
24 }

 

posted @ 2022-04-25 18:16  XGZ21  阅读(33)  评论(0编辑  收藏  举报