当前位置:网站首页>Input some data and find the maximum output. (keyboard and file reading)
Input some data and find the maximum output. (keyboard and file reading)
2022-07-24 07:01:00 【Mo xiaodai ^o^】
Keyboard entry , Until the input non number terminates
#include <iostream>
using namespace std;
int main()
{
int i, j;
cout << " Enter some data :\n";
cin >> i;
int max = i;
while (cin >> j)
{
if (j > max)
max = j;
}
cout << " Maximum MAX = " << max << endl;
return 0;
}File read
#include<fstream>
#include<iostream>
using namespace std;
int main()
{
ifstream in;
ofstream out;
int i, j, max;
in.open("1.txt");
out.open("2.txt");
if (!in)
cout << "1.txt Open the failure !\n";
if (!out)
cout << "2.txt Open the failure !\n";
in >> i;
max = i;
while (in >> j)
{
if (j > max)
max = j;
}
out << " Maximum MAX = " << max;
return 0;
}边栏推荐
- Redis special data type hyperloglog
- owasp top10 渗透测试
- [lvgl (4)] event and event bubble of the object
- JSONObject按照key的A——Z顺序排序
- STM32基于hal库的adc以DMA的多通道采样以及所遇问题解决
- JS and TS learning summary
- xavier_normal_ 初始化测试
- "Big factory interview" JVM Chapter 21 questions and answers
- Introduction to pyqt5 - student management system
- (静态,动态,文件)三个版本的通讯录
猜你喜欢

STM32 ADC based on Hal library uses DMA multi-channel sampling and solves the problems encountered

STM32 MP3 music player based on FatFs r0.14b & SD card (also a simple application of FatFs)

OWASP TOP10 penetration test

Tensorflow Einstein function

【C语言】操作符详解(深入理解+整理归类)

tensorflow einsum函数

metaRTC5.0实现君正的纯C的webrtc版IPC
![[learning notes] Web page rendering process](/img/29/3f419f5851dac1194a94a59635846f.png)
[learning notes] Web page rendering process

MGR_mysqlsh_keepalive高可用架构部署文档

Redis 分片集群
随机推荐
Thinking of data analysis -- analyzing the retail industry as a whole -- an all-round and multifaceted detailed analysis
Redis 分片集群
Camera Hal OEM模块 ---- cmr_grab.c
STM32 external interrupt (register version)
Accumulation of project problems
[lvgl layout] grid layout
Gangster escape 3
STM32 ADC based on Hal library uses DMA multi-channel sampling and solves the problems encountered
Redis数据类型-String(字符串类型)
Redis distributed cache learning notes
GE口:SGMII模式和serdes模式
记录PHPSerializer工具类反序列化遇到的坑
reflex
Can you increase muscle without exercise??? Just get an injection of hibernating black bear serum
Nodejs enables multi process and inter process communication
Don't compare with anyone, just be yourself
项目问题积累
postgresql 日期处理函数用法
Redis基本类型-有序集合Zset
找工作备忘