恩...今天研究信安的课件的时候看到一段对于main(int argc,char *argv[])的编程

所以探究探究main()函数的参数

探究程序如下:

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#define oo 0x13131313
using namespace std;
int main(int n, char *s[ ])
{
printf("%d\n",n);
for(int i=0;i<=n;i++)
printf("%s\n",s[i]);
return 0;
}

一.输入参数的方法:

打开cmd进入当前目录下

C:\Users\Administrator\Desktop>

输入

1.exe aa aa aa

这4个均为main 的参数

二.参数的存储

n=4

s[0] 1.exe

s[1] aa

s[2] aa

s[3] aa

三.输出结果

四.应用

实际上cmd的控制命令(dir,cd之类)也是这样类似的cpp(类c)程序?

所以才能控制参数

2015 5/11

最新文章

  1. 创建SSH Key连接github或gitlab
  2. C#EasyHook例子C# Hook 指定进程C#注入指定进程 z
  3. 那传说中的P、NP以及NPC问题
  4. Apache JMeter - load test tool
  5. nodeJS起步 1
  6. linux 高精度定时器例子
  7. Spring Boot启动过程(二)
  8. JavaScript高级程序设计(二)
  9. spring boot+mybatis+quartz项目的搭建完整版
  10. (八)shell工具-重点
  11. ASP.NET MVC 学习笔记-7.自定义配置信息(后续)
  12. 软件扒网站? 爬虫? F12查看源码? 查看网页源代码?浏览器sources? 区别和联系!
  13. 【转】 ISP-镜头阴影校正(LSC)
  14. fges
  15. css:清楚html所有标签自带属性
  16. scope 前缀开头的方法
  17. html 塊 div span
  18. 为什么使用DLL
  19. 一个登陆浏览api接口; 其他相关: Form_with参数的不同写法; 简单使用curl。
  20. Nlog- Application Logging in C#

热门文章

  1. A Bug&#39;s Life
  2. RelativeLayout与LinearLayout的区别
  3. SQL-LINQ-Lambda 语法对照
  4. 从汇编看c++的new和delete
  5. 在Yii框架中使用PHPExcel
  6. 【Lucene4.8教程之一】使用Lucene4.8进行索引及搜索的基本操作
  7. HttpClient---------demo
  8. ORACLE PL/SQL开发--bulk collect的用法 .
  9. 常用的wsdl地址
  10. grok 正则解析日志例子&lt;1&gt;