计算机系统与云计算1续 ubuntu编写C程序

心不动则不痛 提交于 2019-11-29 06:30:27

ubuntu编写C程序

root@LAPTOP-TOR03L7R:~# touch flow.c
root@LAPTOP-TOR03L7R:~# vim flow.c
root@LAPTOP-TOR03L7R:~# gcc flow.c
flow.c: In function ‘main’:
flow.c:5:13: warning: integer overflow in expression [-Woverflow]
int b=50000*50000;

 

root@LAPTOP-TOR03L7R:~# touch beau.c
root@LAPTOP-TOR03L7R:~# vim beau.c
root@LAPTOP-TOR03L7R:~# g++ beau.c -o beau

root@LAPTOP-TOR03L7R:~# ./beau

beautifulroot@LAPTOP-TOR03L7R:~#

1.touch hello.c   新建一个文件名为 hello.c的源程序

2.vim hello.c 编写程序   按i进入insert 模式 

                                      编写完后 按键盘左上角Esc键 键入:wq 按回车退出程序编写模式

3.gcc hello.c 编译程序 如程序编译中为出错 则无显示

                                   如编译中发现错误会在随后的几行中列出

也可用g++ hello.c -o hello

4.运行程序 如编译无误 ./hello 即出现编译结果

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!