码迷,mamicode.com
首页 >  
搜索关键字:c++学习笔记 判断 循环    ( 98574个结果
Linux shell脚本之判断进程是否在运行
vi proc1.sh #!/bin/bash #此脚本期望的参数个数argno=1 if [ $# -ne $argno ]then echo "Usage: 'basename $0' PID-number" >&2fi if [ ! -f "/proc/$1" ]then echo "Proc ...
分类:系统相关   时间:2021-04-14 11:51:22    阅读次数:0
linux shell命令之脚本要有足够的提示
一个有参数但无提示说明的脚本#login1.sh: 用户登录,判断用户输入的用户名和密码是否错误 vi login1.sh #!/bin/bash for ((i=0; i < 3; i++))do read username read password if test "$username" = ...
分类:系统相关   时间:2021-04-14 11:41:38    阅读次数:0
linux shell 之脚本优化
vi file_can_execute_or_not1.sh #!/bin/bash #判断输入的参数个数是否为两个 if [ $# -lt 2 ]then echo "The num of parameter is not right! " exit 0fi #判断用户输入的第一个文件是否可以读i ...
分类:系统相关   时间:2021-04-13 12:56:38    阅读次数:0
if, if else, else if 的区别,以js为例
一个具有迷惑性的例子,底下的两种情况可以看做两个循环,第一个只要满足一个条件就跳出循环,第二个是不管满足几个条件,都会往下走直至循环结束。 1 var a = 5; 2 if (a > 3) { 3 console.log("第一次执行"); //只有这一个会打印 4 } else if (a > ...
分类:Web程序   时间:2021-04-13 12:54:58    阅读次数:0
【LeetCode】1822. 数组元素积的符号
思路:遍历判断每个数的正负 class Solution { public: int arraySign(vector<int>& nums) { int ans = 1; for(auto &n : nums){ if(n == 0) return 0; ans *= (n > 0) ? 1 : ...
分类:编程语言   时间:2021-04-13 12:40:39    阅读次数:0
【Golang】由 for range 循环引出的一些思考
一、背景 今天看到组内项目中有这样一段代码 ,第一反应是局部变量 index 太奇怪了,当然也不能说这样写是错的,只是个人强迫症看着很难受... 1 for _, index := range entities { 2 key := index.TemplateId 刚好借此机会,梳理下 Go 的 ...
分类:其他好文   时间:2021-04-13 12:32:49    阅读次数:0
常用语句
# 常用语句 ## 条件语句 ### if.....else.... while True: x = int(input("请输入数字:50")) if x >50: print("你输入的数大于50") else: print("你输入的值小于50") ### if....elif....else ...
分类:其他好文   时间:2021-04-13 12:27:47    阅读次数:0
c语言入门教程–-5判断语句
#include<stdio.h> int main() { int a=1; int b=1; if(a==b) { printf("相等"); } else { printf("不相等"); } return 0; } ...
分类:编程语言   时间:2021-04-13 12:15:37    阅读次数:0
c语言入门教程–-6循环语句
c语言入门教程–-6循环语句 c语言提供了以下几种循环类型。while循环for 循环do…while 循环 while循环 #include <stdio.h> int main () { /* 局部变量定义 */ int a = 10; /* while 循环执行 */ while( a < 2 ...
分类:编程语言   时间:2021-04-13 12:12:17    阅读次数:0
Java中字符串判空的正确打开方式
首先,先说结论: 记住三个要点: 1、s == null是一定要判断的,而且一定要放到最先判断的位置 2、s.isEmpty() 和 s.length() == 0 完全等价 3、要剔除空格,请用 trim()方法 public void test(String s){ //最基本的判空,安全方法 ...
分类:编程语言   时间:2021-04-13 11:59:54    阅读次数:0
98574条   上一页 1 ... 57 58 59 60 61 ... 9858 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!