码迷,mamicode.com
首页 >  
搜索关键字:elseif    ( 492个结果
编写一个程序,它从标准输入(终端)读取C源代码,并验证所有的花括号都正确的成对出现。
#include<stdio.h> intmain() { intcou=0; charch; while((ch=getchar())!=‘\n‘) { if(ch==‘{‘) cou++; elseif(ch==‘}‘) { if(cou==0) printf("匹配不成功!"); cou--; } } if(cou==0) printf("匹配成功!"); else printf("匹配不成功!"); return0; }
分类:其他好文   时间:2015-10-31 01:42:54    阅读次数:119
字符匹配
#include<stdio.h> #include<stdlib.h> intmain() { intch=0; intcount=0; while((ch=getchar())!=EOF)//输入字符不为空,结束时用^Z { if((ch==‘}‘)&&(count==0)) printf("notmatch\n"); elseif(ch==‘{‘) { count++; } elseif((ch==..
分类:其他好文   时间:2015-10-29 18:27:48    阅读次数:187
力战SDRAM(三)
我们分两条主线来介绍SDRAM的读写:地址线和数据线首先地址线上,在FPGA启动,延时500微妙。然后地址计数器cntwr每等到延时500us加1(elseif(delay_done)cntwr<=cntwr+1‘b1)直到加到63,然后让地址寄存器addr加1。(elseif(!wr_done&&cntwr==6‘h3f)addr<=addr+1..
分类:其他好文   时间:2015-10-28 19:32:18    阅读次数:228
PHP获取IP地址
获取客户端IP地址::function getIp(){if(!empty($_SERVER['HTTP_CLIENT_IP'])){ return $_SERVER['HTTP_CLIENT_IP']; }elseif(!empty($_SERVER['HTTP_X_FORVARDED_FOR.....
分类:Web程序   时间:2015-10-28 19:04:38    阅读次数:143
If...Else 和Switch 判断语句的使用
<?php $t=date("50"); if($t<"10"){ echo"Haveagoodmorning!"; }elseif($t<"20"){ echo"Haveagoodday!"; }else{ echo"Haveagoodnight!"; } ?> <?php$num=100; switch($num){ case10: echo("好"); break; case20: echo("很好"); break; default: ..
分类:其他好文   时间:2015-10-28 17:30:10    阅读次数:125
折半查找数组中某一元素(二分法查找)
#include<stdio.h>intbin_search(intarr[],intsize,intkey){intleft=0;intright=size-1;while(left<=right){intmid=(left+right)/2;if(arr[mid]>key)right=mid-1;elseif(arr[mid]<key)left=mid+1;else{returnmid;//如果能找到,则返回mid下标}}return-1;如果找..
分类:编程语言   时间:2015-10-28 07:09:21    阅读次数:262
【C语言】编写一个程序统计输入字符串中: 各个数字、空白字符、以及其他所有字符出现的次数。
#include<stdio.h> intmain() { chars[20]; charnum=0; intnum_count=0; intspace_count=0; intother_count=0; while((num=getchar())!=‘\n‘) { if(num>=‘0‘&&num<=‘9‘) { num_count++; } elseif(num==‘‘) { space_count++; } else { other_count..
分类:编程语言   时间:2015-10-27 07:08:05    阅读次数:234
LAYERSLIDER 5插件源码破解
functionlsShowNotice(e,t,n){ varr; if(typeofe=="string"){ r=jQuery("#"+e) }elseif(typeofe=="object"){ r=e } vari,s; switch(t){ case"jquery": i="multiplejQueryissue"; s=‘ItlookslikethatanotherpluginoryourthemeloadsanextracopyofthejQuerylibrary..
分类:其他好文   时间:2015-10-25 19:30:20    阅读次数:169
计算单词的个数
#include<stdio.h> intmain() { charstring[50]; charc; inti,num=0,word=0; gets(string); for(i=0;(c=string[i])!=‘\0‘;i++) { if(c==‘‘) { word=0; } elseif(word==0) { word=1; num++; } } printf("word=%d",num); return0; }
分类:其他好文   时间:2015-10-23 00:15:24    阅读次数:193
一道验证花括号匹配的编程题
//编写一个程序,它从标准输入读取C源代码,并验证所有的花括号都正确的成对出现 #include<stdio.h> intmain() { intch=0; intcount=0; while((ch=getchar())!=EOF) { if(ch==‘{‘) count++; elseif((ch==‘}‘)&&(count==0)) { printf("匹配不成功!\n");..
分类:其他好文   时间:2015-10-22 19:38:32    阅读次数:225
492条   上一页 1 ... 31 32 33 34 35 ... 50 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!