当前位置:网站首页>c语言:11、管道
c语言:11、管道
2022-07-27 16:47:00 【兔头哥哥】
c语言:11、管道
1、linux管道简介
查看/etc/下面有没有包含ab字符的文件ls /etc/ | grep ab
上方命令本质是将ls命令的输出流作为grep命令的输入流
2、c语言使用管道例子
/avg.c
avg.c主要计算两个数字的平均值
#include <stdio.h>
int main()
{
int sum,num;
scanf("%d,%d", &sum,&num);
float result = sum/num;
printf("result=%f\n", result);
return 0;
}

/input.c
input.c主要统计输入的所有数字的总和以及数量
#include <stdio.h>
int main()
{
int flag=1;
int i;
int count=0;
int s=0;
while(flag){
scanf("%d", &i);
if(0==i) break;
count++;
s+=i;
}
printf("%d,%d\n", s, count);
return 0;
}

avg.c和input.c使用管道串联起来,计算3000+2000的平均值
边栏推荐
- X-shell remote connection virtual machine
- Anaconda下安装Talib库
- 浅谈基本的网络基本故障和问题排查
- kettle学习——8.2版本的资源库配置变为灰色,且没有了Connect按钮
- FZU1669 Right-angled Triangle【毕达哥拉斯三元组】
- Kinect for unity3d - backgroundremovaldemo learning
- IPFs obtains the public key and private key through the interface, and encrypts the storage. First bullet
- Basic knowledge of C language (for personal use)
- sql 字段类型转换
- Using MATLAB to generate graphics for journals and conferences - plot
猜你喜欢

2022 Ningde Vocational College Teachers' practical teaching ability improvement training - network construction and management

go-zero单体服务使用泛型简化注册Handler路由

Webmagic+selenium+chromedriver+jdbc grabs data vertically.

kettle引用外部脚本完成电话号码清洗、去重缩进

ES6学习笔记(1)——快速入门

Basic network faults and troubleshooting

The go zero singleton service uses generics to simplify the registration of handler routes

Technology Summit 58 Liu Yuan in the same city was invited to attend qecon 2022 global software quality & effectiveness conference

电商商城小程序项目完整源码(微信小程序)

图的遍历的定义以及深度优先搜索和广度优先搜索(二)
随机推荐
Basic use of Nacos (1) - getting started
An experience
Basic knowledge of C language (for personal use)
kettle 合并记录 数据减少
Performance analysis of continuous time system (1) - performance index and first and second order analysis of control system
Using vscode to build u-boot development environment
ReferenceError: __dirname is not defined in ES module scope
The first entry-level operation of kettle (reading excel, outputting Excel)
Questions about webservice
asp.net 的经验
webservice的疑问
2022 preparation for autumn recruitment 10W word interview sketch PDF version, with operating system and computer network interview questions
Kinect for unity3d - backgroundremovaldemo learning
HDU1171_Big Event in HDU【01背包】
Kettle8.2 installation and common problems
ref 关键字的用法
Some advice for NS2 beginner.
Kinect2 for unity3d - avatardemo learning
Nacos集群部署-高可用保证
2022 Ningde Vocational College Teachers' practical teaching ability improvement training - network construction and management