新手请教一个问题
xcode吧
全部回复
仅看楼主
level 4
小宇PATO 楼主
大学开了一门c++课程,由于我是mac用户,之前一段时间我装了虚拟机,专门为了跑vc,可是今天虚拟机不行了,我只得卸载,无奈之下硬着头皮用xcode编小程序,请问一下开头这个是什么意思
2013年03月06日 03点03分 1
level 4
小宇PATO 楼主
int main(int argc, const char * argv[])
就是上面这一行,是什么意思
2013年03月06日 03点03分 2
把()里面的东西删除就是
2013年04月11日 02点04分
int是返回值,括号中的是参数,你可以不管它,或者直接删除
2013年06月01日 05点06分
int是返回值,括号中的是参数,你可以不管它,或者直接删除
2013年06月01日 05点06分
level 4
小宇PATO 楼主
xcode为什么不能应用 iostream.h? 疑问ing...
2013年03月06日 03点03分 3
可以,选择c++环境
2013年04月11日 02点04分
level 4
小宇PATO 楼主
如果能帮助我走进编程的话 加我qq吧
529783170
验证:赵新宇
2013年03月06日 03点03分 4
贴吧有群号,你可以加一下
2013年04月11日 02点04分
level 6
主函数,程序的入口。运行程序时先运行这个函数。把程序比喻成一个大厦,main函数就是进入这个大厦的门
2013年03月07日 02点03分 5
(int argc, const char * argv[])这些呢
2013年03月07日 08点03分
参数,不知道你用过DOS或者命令行不。比如说copy c:\x.x d:\。这个命令来说如果copy是个程序,那么后面两个地址就是传递给main的参数。你的实例里参数是以数组接收的,可以接收n个参数 ——来自 爱贴吧 Windows Phone 客户端
2013年03月08日 01点03分
level 1
问一下,你在哪输入“年月份”,我用XCODE找不到输入的窗口啊
2013年03月16日 13点03分 6
就是输出的地方
2013年04月11日 02点04分
level 4
Reference:
syntax:
ISO/IEC 14882:2011 C plus plus standard paper
3.6.1 Main function
int main(int argc, char* argv[]) { /* ... */ }
In the latter form argc shall be the number of arguments passed to the program from the environment in
which the program is run. If argc is nonzero these arguments shall be supplied in argv[0] through
argv[argc-1] as pointers to the initial characters of null-terminated multibyte strings (NTMBSs)
(17.3.2.1.3.2) and argv[0] shall be the pointer to the initial character of a NTMBS that represents the
name used to invoke the program or "". The value of argc shall be nonnegative. The value of
argv[argc] shall be 0. [Note: it is recommended that any further (optional) parameters be added after
argv. ]
Reference:
Version2: <<C plus plus primer>> author:stanly .B.lippman
7.2.6 main:处理命令行
主函数main是演示c程序如何将数组传递给函数的好例子,直到现在,我们定义的主函数都只有空的形参表:
int main() {...}
但是,我们通常需要给main传递实参,传统上,主函数的实参是可选的,用来确定程序要执行的操作,比如,假设我们的主函数main位于名为,prog的可执行文件中,可如下将实参选项传递给程序:
prog -d -o -ofile -data0
这种用法的处理方法实际上是在主函数main中定义了两个形参:
int main(int argc,char *argv[]){.....}
2013年04月11日 14点04分 7
wow
2013年04月11日 15点04分
level 4
学校断网。手机打字累。。明天说。。[被砸]
2013年04月11日 15点04分 8
大神,刚刚下载了Xcode4.6.2,可是不会用,就大神指导[呵呵]
2013年05月30日 11点05分
我QQ:951393152,验证:大神[乖]
2013年05月30日 11点05分
level 4
最后说一句。landlord p
lz
zzz 不要经常是用。名字空间std
2013年04月11日 15点04分 9
level 4
Reference:
Add contents:
第二个形参agrv是一个c风格字符串数组,第一个形参agrc则用于传递该数组字符串的个数,由于第二个形参是数组,主函数main也可以这样定义:
int main(int agrc,char **agrv){.....}
表示agrv是指向char*的指针
当将实参传递个主函数main时,agrv中的第一个字符串(如果有的话)通常是程序的名字.接下来的元素将额外的可选字符串传递个主函数main.以前的命令行为例,agrc应设为5,agrv会保存下面几个c风格字符串:
agrv[0]=;
agrv[1]="prog";
agrv[2]="-d";
agrv[3]="-o";
agrv[4]=-data0;
---------------------------------------------------------------------
2013年04月12日 11点04分 10
1