c++ question 003 求两数大者?
#include <iostream>
using namespace std;
int main(){
//求两数中的大者?
int a,b;
cin>>a>>b;
if(a>b)
cout<<"The max number is:"<<a;
else
cout<<"The max number is:"<<b;
}
method two:
#include <iostream>
using namespace std;
int main(){
//求两数中的大者?
int a,b,max;
cin>>a>>b;
if(a>b)
max=a;
else
max=b;
cout<<"The max number is:"<<max;
}
c++ question 003 求两数大者?的更多相关文章
- d008: 求两数的整数商 和 商
内容: 求两数的整数商 和 商 ,商保留两位小数 输入说明: 一行 两个整数 输出说明: 一行,一个整数,一个实数(两位小数) 输入样例: 12 8 输出样例 : 1 1.50 #include ...
- d007: 求两数的整数商 和 余数
内容: 求两数的整数商 和 余数 输入说明: 一行两个整数 输出说明: 一行两个整数 输入样例: 18 4 输出样例 : 4 2 #include <stdio.h> int main ...
- 【c语言】不用大与小与号,求两数最大值
// 不用大与小与号,求两数最大值 #include <stdio.h> int max(int a, int b) { int c = a - b; int d = 1 << ...
- c++程序设计第三版例题1.2 求两数的和
#include <iostream>using namespace std; int main(){ //求两数之和 int a,b,sum; a=11; b=22; sum=a+b; ...
- C 语言实例 - 求两数最小公倍数
C 语言实例 - 求两数最小公倍数 用户输入两个数,其这两个数的最小公倍数. 实例 - 使用 while 和 if #include <stdio.h> int main() { int ...
- C 语言实例 - 求两数的最大公约数
C 语言实例 - 求两数的最大公约数 用户输入两个数,求这两个数的最大公约数. 实例 - 使用 for 和 if #include <stdio.h> int main() { int n ...
- c++作业:输入两个整数,用函数求两数之和。函数外部声明有什么作用?
#include <iostream> using namespace std; int main(){ //求两数的和? int a,b,s; cout<<"请你输 ...
- ✡ leetcode 167. Two Sum II - Input array is sorted 求两数相加等于一个数的位置 --------- java
Given an array of integers that is already sorted in ascending order, find two numbers such that the ...
- 【leetcode74】Sum of Two Integers(不用+,-求两数之和)
题目描述: 不用+,-求两个数的和 原文描述: Calculate the sum of two integers a and b, but you are not allowed to use th ...
随机推荐
- myeclipse svn 在线安装
https://www.cnblogs.com/sxdcgaq8080/p/6000446.html http://subclipse.tigris.org/update_1.8.x
- git教程2-git基础
clone 使用IDE,直接在vcs里,从git checkout,方便. commit commit是提交到本地git仓库,本质是做一次存储快照. 可以多次commit之后,再次push到git服务 ...
- ACM-ICPC 2018 南京赛区网络预赛 J sum (找一个数拆成两个无平方因子的组合数)
题目大意:就是找一个数拆成两个无平方因子的组合数,然后求个前缀和 ; 分析:运用筛法的思想 , 因为有序对是由两个合法的数字组成的,所以只要保证第一个数合法,第二个数也合法就行,找出合法的第二个数 ...
- dos for循环
in (phone.txt) do ( 127.0.0.1 > tmp_file ) ) do ( 127.0.0.1 > tmp_file )
- Java实现快排+小坑+partition的两种思路
在做一道剑指Offer的题的时候,有道题涉及到快排的思路,一开始就很快根据以前的思路写出了代码,但似乎有些细节不太对劲,自己拿数据试了下果然.然后折腾了下并记录下一些小坑,还有总结下划分方法parti ...
- PyQt学习笔记
---------------个人学习笔记--------------- 1.QtWidgets.QApplication.instance().quit() 方法可退出当前窗体 2.self.Qla ...
- db2一些简单操作及错误记录
操作: 删除主键: alter table tablename drop parimary key 添加主键: alter table tablename add primary key(colum ...
- magento新增商品属性以及将属性加入Flat table
magento的EAV模型非常强大且灵活,但是如果不做优化的话,性能会非常低,因为attributes都存放在附表里,要获取一个entity的attribute,需要表联结一次,如果需要获取多条att ...
- BZOJ3624: [Apio2008]免费道路(最小生成树)
题意 题目链接 Sol 首先答案一定是一棵树 这棵树上有一些0边是必须要选的,我们先把他们找出来,如果数量$\geqslant k$显然无解 再考虑继续往里面加0的边,判断能否加到k条即可 具体做法是 ...
- substring、slice、substr的区别
首先定义一个变量便于下面测试:var str = "xx351223441"; substring: str.substring(form,to):从字符串里截取下标为form ...