当前位置:网站首页>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的平均值
边栏推荐
- Latex use - subfigure vertical graphics
- Electromagnetic field learning notes - vector analysis and field theory foundation
- JS common utils encapsulation
- Kettle learning - the repository configuration in version 8.2 is grayed out, and there is no connect button
- Self control principle learning notes - system stability analysis (1) - BIBO stability and Routh criterion
- Word 2007+ tips
- Webmagic+selenium+chromedriver+jdbc垂直抓取数据。
- SSM project uses filter to realize login monitoring
- Power control
- 一个经验
猜你喜欢

Rename file with command line

Programming jump

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

Webmagic+selenium+chromedriver+jdbc grabs data vertically.

一篇让你掌握线程和线程池,还解决了线程安全问题,确定不看看?

来一遍《剑指Offer》03. 数组中重复的数字

Win10 tips (1) -- transfer desktop location

2022备战秋招10W字面试小抄pdf版,附操作系统、计算机网络面试题

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

Subscription and use of Alibaba cloud video on demand service
随机推荐
IDEA成功连接Database但不显示表怎么办
200 lines of code quick start document database monogodb
I'm afraid I won't use the JMeter interface testing tool if I accept this practical case
JS common utils encapsulation
Use fastjson JSON (simple and rough version)
How can I get started quickly when I change my career to soft testing and job hopping to a new company?
v-if,v-else,v-for
MongoDB学习笔记(1)——安装MongoDB及其相关配置
C language printing diamond
kettle学习——8.2版本的资源库配置变为灰色,且没有了Connect按钮
C语言打印菱形
Kettle JVM memory setting - the effect is not obvious
FZU1669 Right-angled Triangle【毕达哥拉斯三元组】
Double insurance for line breaking
Kinect2 for unity3d - avatardemo learning
[cloud picture theory] the first time to know Huawei cloud micro service engine CSE in issue 250
Definition of graph traversal and depth first search and breadth first search (2)
Using MATLAB to generate graphics for journals and conferences - plot
Kinect for Unity3d----KinectManager
Cyclic multi-Variate Function for Self-Supervised Image Denoising by Disentangling Noise from Image