码迷,mamicode.com
首页 >  
搜索关键字:for while until    ( 29426个结果
字符串-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
分支-06. 成绩转换(15)
#includeusing namespace std;int main(){ int p; while(cin>>p) if(p>=90) cout=80) cout=70) cout=60) cout<<"D"<<endl; else cout<<"E"<<endl; r...
分类:其他好文   时间:2014-07-02 18:57:53    阅读次数:152
分支-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
分支-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
分支-03. 三天打鱼两天晒网(15)
#includeusing namespace std;int main(){ int days; while(cin>>days){ if(days%5=1) cout<<"Fishing in day "<<days<<endl; else cout<<"Drying in day ...
分类:其他好文   时间:2014-07-02 14:50:19    阅读次数:198
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!