码迷,mamicode.com
首页 >  
搜索关键字:while loop    ( 31405个结果
字符串-05. 字符串循环左移(20)
1 #include 2 #include 3 using namespace std; 4 int main(){ 5 string s; 6 int n; 7 getline(cin,s); 8 cin>>n; 9 while(n--)10 ...
分类:其他好文   时间:2014-07-07 12:44:52    阅读次数:170
循环-01. 求整数段和(15)
1 #include 2 #include 3 using namespace std; 4 int main(){ 5 int m,n,c=0,sum=0; 6 cin>>m>>n; 7 while(m<=n){ 8 if(c&&c%5==0) 9 ...
分类:其他好文   时间:2014-07-07 12:35:43    阅读次数:253
论条件变量cond_wait的原子性
使用的基本模板如下(参考APUE):signal代码序列如下,pthread_mutex_lock...pthread_cond_signalpthread_mutex_unlockwait代码序列如下,while (1){ pthread_mutex_lock(&mutex); ...
分类:其他好文   时间:2014-07-07 12:16:56    阅读次数:236
循环-02. 计算圆周率(15)
1 #include 2 #include 3 using namespace std; 4 int main(){ 5 double t,pai=1,son=1,mum=1; 6 int i=1; 7 cin>>t; 8 while(son/mum>=t){ 9 ...
分类:其他好文   时间:2014-07-07 11:43:21    阅读次数:207
PHP、Java输出json格式数据
PHP 输出json。 $result = mysql_query($sql); //查询结果 $users=array(); $i=0; while($row=mysql_fetch_array($result,MYSQL_ASSOC)){ $users[$i]=$row; $i+...
分类:编程语言   时间:2014-07-07 11:12:16    阅读次数:293
分支-14. 简单计算器(10)
1 #include 2 using namespace std; 3 int main(){ 4 int a,b; 5 char s; 6 while(cin>>a){ 7 cin>>s>>b; 8 if(s=='+') 9 ...
分类:其他好文   时间:2014-07-02 17:36:14    阅读次数:149
Runloop
一、Runloop简介:Run loops 是线程相关的的基础框架的一部分。一个 run loop 就是一个事件处理 的循环,用来不停的调度工作以及处理输入事件。使用run loop的目的是让你的线程在有工作的时候忙于工作,而没工作的时候处于休眠状态。Runloop还可以在loop在循环中的同时响应...
分类:其他好文   时间:2014-07-02 17:33:39    阅读次数:220
分支-15. 日K蜡烛图(15)
1 #include 2 using namespace std; 3 int main(){ 4 float o,h,l,c; 5 while(cin>>o>>h>>l>>c){ 6 if(co) 9 couto&&h>c)14 ...
分类:其他好文   时间:2014-07-02 17:29:47    阅读次数:264
字符串-02. 删除字符串中的子串(20)
1 #include 2 #include 3 using namespace std; 4 int main(){ 5 string s1, s2; 6 getline(cin, s1); 7 getline(cin, s2); 8 while(s1.find(s...
分类:其他好文   时间:2014-07-02 17:17:29    阅读次数:281
uva 10127 - Ones(数论)
题目链接:uva 10127 - Ones 题目大意:给出n,问说者少要多少为1才可以整除n。 解题思路:等于是高精度取模,直到余数为0为止。 #include #include int main () { int n; while (scanf("%d", &n) == 1) { int ans = 1, c = 1; whil...
分类:其他好文   时间:2014-07-02 15:16:16    阅读次数:210
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!