02 2013 档案

摘要:#include <iostream>int main(){ using namespace std; int n; cout<<"Enter numbers in the range 1-10 to find "; cout<<"my favorite number\n"; do { cin>>n; }while(n!=7); cout<<"Yes,7 is my favorite.\n"; return 0;} 阅读全文
posted @ 2013-02-27 16:50 徐耀湘 阅读(152) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>#include <cstring>using namespace std;int main(){ using namespace std; char word[5]="?ate"; for(char ch='a';strcmp(word,"mate");ch++) { cout<<word<<endl; word[0]=ch; } cout<<"After loop ends.word is "<<word& 阅读全文
posted @ 2013-02-27 15:21 徐耀湘 阅读(168) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>#include <cstring>int main(){ using namespace std; cout<<"Enter a word: "; string word; cin>>word; char temp; int i,j; for(j=0,i=word.size()-1;j<i;--i,++j) { temp=word[i]; word[i]=word[j]; ... 阅读全文
posted @ 2013-02-27 11:23 徐耀湘 阅读(162) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>int main(){ using namespace std; cout<<"The Amazing Accounto will sum and average "; cout<<"five numbers for you.\n"; cout<<"Please enter five values:\n"; double number; double sum=0.0; for(int i=1;i<=5;i++) { ... 阅读全文
posted @ 2013-02-27 11:07 徐耀湘 阅读(2243) 评论(0) 推荐(0) 编辑