摘要: #include <iostream>#include <vector>#include <algorithm>using namespace std;int testscore[] = {67, 56, 24, 78, 99, 87, 56}; void main(){ vector<int> score(testscore,testscore+sizeof(testscore)/sizeof(int)); vector<int>::iterator it; copy(score.begin(),score.end(),ostrea 阅读全文
posted @ 2012-02-08 00:00 Dsp Tian 阅读(647) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <vector>#include <algorithm>#include <numeric>#include <string>using namespace std;int testscore[] = {67, 56, 24, 78, 99, 87, 56}; bool pass(int n){ if (n>=60) return true; else return false;}void main(){ vector<int> score(testscore, 阅读全文
posted @ 2012-02-07 21:27 Dsp Tian 阅读(791) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <vector>#include <string>#include <boost/shared_ptr.hpp>class A{public: A(std::string s){a=s;} std::string a; void print(){std::cout<<a<<'\n';} };void main(){ boost::shared_ptr<A> p1(new A("2345")); boost::shared 阅读全文
posted @ 2012-02-07 17:52 Dsp Tian 阅读(559) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <string>#include <boost/lexical_cast.hpp>using namespace std;using namespace boost;int main(){ string i; try { i=lexical_cast<string>(123.134); } catch(bad_lexical_cast&e) { cout<<e.what()<<endl; return 1; } cout<<i<<end 阅读全文
posted @ 2012-02-06 22:01 Dsp Tian 阅读(739) 评论(0) 推荐(0) 编辑
摘要: cl;img=imread('1.bmp');[m n]=size(img);imshow(img)imgn=img;temp=[];%开操作for i=2:m-1 %腐蚀 for j=2:n-1 temp=img(i-1:i+1,j-1:j+1); imgn(i,j)=min(temp(:)); endendfor i=2:m-1 %膨胀 for j=2:n-1 temp=img(i-1:i+1,j-1:j+1); imgn(i,j)=max(... 阅读全文
posted @ 2012-02-05 19:45 Dsp Tian 阅读(2270) 评论(0) 推荐(0) 编辑
摘要: cl;img_gray=imread('fupeng.jpg');img_erzhi=imread('erzhi_fupeng.jpg');imshow(img_gray)figure,imshow(img_erzhi)[m n]=size(img_gray);img_gray_fu=zeros(m,n);img_gray_peng=zeros(m,n);img_erzhi_fu=zeros(m,n);img_erzhi_peng=zeros(m,n);for i=2:m-1 for j=2:n-1 img_gray_fu(i,j)=min(min(img_gr 阅读全文
posted @ 2012-02-05 16:02 Dsp Tian 阅读(11964) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <stdlib.h>#include <time.h>using namespace std;#define NUM 30 //区间个数typedef struct { int min; //区间中最小值 int max; //区间中最大值 int diff; //区间的大小}extent;int Max(int a,int b){ if (a>=b) { return a... 阅读全文
posted @ 2012-02-03 15:17 Dsp Tian 阅读(1234) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;int main(){ int a[9]={2,8,1,7,5,6,9,3,0}; int b[10]; int i; for (i=0;i<10;i++) { b[i]=-1; } for (i=0;i<9;i++) { b[a[i]]=a[i]; } for (i=0;i<10;i++) { if (b[i]==-1) { cout<<i<<endl; ... 阅读全文
posted @ 2012-02-03 13:33 Dsp Tian 阅读(508) 评论(0) 推荐(0) 编辑
摘要: cl;img=imread('1.bmp');img=double(img);imshow(mat2gray(img));[m n]=size(img);imgn=zeros(m-3,n-3);temp=[];for i=1:m-3 for j=1:n-3 temp=img(i:i+3,j:j+3); imgn(i,j)=median(temp(:)); endendfigure,imshow(mat2gray(imgn))imgn=img(1:m-3,1:n-3)-imgn;figure,imshow(mat2gray(imgn))imgn=i... 阅读全文
posted @ 2012-02-02 13:09 Dsp Tian 阅读(2086) 评论(2) 推荐(0) 编辑
摘要: #include <iostream>#include <string>#include <fstream>#include <iomanip>using namespace std;int main(){ ofstream fs("123.txt",ios::app); fs<<setw(7)<<"234234"<<setw(3)<<"12"<<endl; system("pause"); return 0 阅读全文
posted @ 2012-02-01 17:24 Dsp Tian 阅读(533) 评论(0) 推荐(0) 编辑