码迷,mamicode.com
首页 >  
搜索关键字:elseif    ( 492个结果
matlab中使用elseif和if嵌套的对比
% 目标:% 判定成绩等级%定义变量% 输入:分数grade%清除变量或指令clc;% 允许用户输入参数disp ('该功能练习if语句');disp ('输入你的成绩,系统将判定等级. ');grade = input ('输入分数: ');%根据分数情况讨论if grade > 95.0 %等....
分类:其他好文   时间:2015-10-02 22:31:35    阅读次数:194
转换大小写字母
#include<stdio.h> intmain() { charnum; while(scanf("%c",&num)==1) { if((num>=65)&&(num<=90)) { num=num+32; printf("%c\n",num); } elseif((num>=97)&&(num<=122)) { num=num-32; printf("%c\n",num); } else ..
分类:其他好文   时间:2015-09-29 01:19:44    阅读次数:206
php笔记二:分支语句
1、if语句分为三种情况:单分支 if(条件){}双分支 if(条件){} else{}多分支 if(条件){} elseif(条件){} elseif(条件){} ...else{}2、switch语句格式:switch(表达式){ case 值1: 语句1; break...
分类:Web程序   时间:2015-09-27 10:01:48    阅读次数:139
输入一个字符统计其中有多少个单词。
#include<stdio.h>intmain(){ charstring[81]; inti,num=0,word=0; charc; gets(string);//输入一个字符串给字符组stringfor(i=0;(c=string[i])!=‘\0‘;i++)//只要字符不是‘\0‘就继续执行循环 if(c==‘‘)word=0;//如果是空字符,word为0 elseif(word==0)//如果不是空格字符..
分类:其他好文   时间:2015-09-27 06:35:04    阅读次数:237
初涉 C 语言——(2)
折半查找函数#include<stdio.h> inthalf_search(intarr[],intfirst,intlast,intn) { intmid=0; while(first<=last) { mid=(first+last)/2; if(n<arr[mid])//若要查找的数字小于中间数,则在前一半查找 { last=mid-1;//范围缩小 } elseif(n>arr[mid])//若大于中..
分类:编程语言   时间:2015-09-25 16:36:19    阅读次数:152
js实现收藏网址
js代码如下:functionaddFavorite(){varurl=window.location;vartitle=document.title;varua=navigator.userAgent.toLowerCase();if(ua.indexOf("360se")>-1){alert("由于360浏览器功能限制,请按Ctrl+D手动收藏!");}elseif(ua.indexOf("msie8")>-1){window.external.Ad..
分类:Web程序   时间:2015-09-24 19:36:32    阅读次数:231
用c语言求ax^2+bx+c=0方程的解
用c语言求ax^2+bx+c=0方程的解。#include<stdio.h>#include<math.h>#definem0.000001intmain(){floata,b,c,x,x2,n,q,p;scanf("%f%f%f",&a,&b,&c);n=b*b-4*a*c;if((a<m)&&(a>-m)){x=(-c)/b;printf("%f",x);}elseif((n<m)&&(n&..
分类:编程语言   时间:2015-09-23 01:27:15    阅读次数:144
比较三个数大小
#include<stdio.h>voidmain(){inta,b,c;printf("请输入三个数\n");scanf("%d,%d,%d",&a,&b,&c);if(a>b)if(a>c)printf("最大是%d",a);elseprintf("最大是%d",c)elseif(b>c)printf("最大是%d\n",b);elseprintf("%d\n",c);return0;}
分类:其他好文   时间:2015-09-22 00:10:43    阅读次数:152
从标准输入读取C源代码,并验证所有的花括号都正确的成对出现
#include<stdio.h>#include<process.h>intmain(){ charc=0; intcount=0; while((c=getchar())!=EOF) { if(c==‘{‘) { count++; } elseif(c==‘}‘&&count==0) { printf("花括号不匹配!"); return0; } elseif(c==‘}‘&&count!=0) { co..
分类:其他好文   时间:2015-09-21 19:45:03    阅读次数:153
PHP判断是否为手机客户端
0){// 检查浏览器是否接受 WML. return true; }elseif(preg_match('/(blackberry|configuration\/cldc|hp |hp-|htc |htc_|htc-|iemobile|kindle|midp|mmp|motor...
分类:移动开发   时间:2015-09-19 18:20:32    阅读次数:227
492条   上一页 1 ... 33 34 35 36 37 ... 50 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!