没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
试读
2页
1. 实训目的 掌握Linux下编程,熟悉Linux的编程 2. 实训内容 1) Linux下的C/C++编程,编写简单的C/C++程序并编译运行。 2) Linux下的python 编程,利用python语言编写程序。 3) Linux下的shell编程,从键盘输入任意值,然后利用while进行求和运算。 3. 实训总结 通过本次实训,能够掌握Linux下的各种编程工具。
资源推荐
资源详情
资源评论
14.4 上机实训
1. 实训目的
掌握 Linux 下编程,熟悉 Linux 的编程
2. 实训内容
1) Linux 下的 C/C++编程,编写简单的 C/C++程序并编译运行。
2) Linux 下的 python 编程,利用 python 语言编写程序。
3) Linux 下的 shell 编程,从键盘输入任意值,然后利用 while 进行求和运算。
3. 实训总结
通过本次实训,能够掌握 Linux 下的各种编程工具。
上机实训步骤:
1. Linux 下的 C/C++编程,编写简单的 C/C++程序并编译运行。
[root@localhost root ] #vim hello.c
#include <stdio.h>
int main( )
{
printf ("Hello world, Linux programming!");
return 0;
}
2)执行命令编译和运行程序,目标程序名为 hello
[root@localhost root ] # gcc hello.c -o hello
[root@localhost root ] # ./hello
Hello world, Linux programming!
2. Linux 下的 python 编程,利用 python 语言编写程序。
#while01.py
#!/usr/bin/env python3
sum = 0 // 定义变量存放累加和
x=0
score=int(input(' Please enter your score ')) //输入值
while x <=score: //while 循环
sum = sum + x //求和
x=x+1
print('The total sum is %d' % sum) //输出结果
执行下面的命令运行程序
[root@localhost python3]# python3 while01.py
Please enter your score 100
The total sum is 5050
3. Linux 下的 shell 编程,从键盘输入任意值,然后利用 while 进行求和运算。
[root@localhost root ] #vim add
#to test ‘while’
read Num
result=0
i=1
while [ $i -le $Num ]
资源评论
会的东西有点杂
- 粉丝: 742
- 资源: 230
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功