摘要:
%双线性内插法做图像旋转clear,homeformat compacta=imread('Gone_with_the_wind_8bits.bmp');%读入图像[m,n]=size(a);alpha_=input('请输入旋转角(角度制):');alpha_=mod(alpha_,360);alpha=alpha_*pi/180;%则旋转后的图形的大框的高度和宽度为gd=round(abs(m*cos(alpha))+abs(n*sin(alpha)));kd=round(abs(m*sin(alpha))+abs(n*cos(alpha)));b=zero 阅读全文
摘要:
#include<iostream>using namespace std;void main(){/*判断一个数是否能被3,5,7整除,以及整除的结果*/cout<<"请输入一个数,判断其分别被3,5,7整除的情况:";int a,s;cin>>a;s=((a%3==0?1:0)<<2)|((a%5==0?1:0)<<1)|(a%7==0?1:0);cout<<s<<endl;switch(s){case 0:cout<<"不能被3,5,7整除\n";bre 阅读全文
摘要:
#include<iostream>#include<fstream>#include<sstream>#include<string>#include<algorithm>#include <vector>using namespace std;typedef vector<int> VI;typedef vector< vector<int> > VVI;void main(){string s1;ifstream fin("aaa.txt");ofstream 阅读全文
摘要:
// binary.h //#include"stack.h"char Getdata() {char data; cin>>data; return data;} //Getdatavoid CreateBiTree(BiTree &T)//建立二叉链表{char ch;ch=Getdata();if(ch=='#') T=NULL;else{T=new BiTNode;T->data=ch;CreateBiTree(T->lchild);CreateBiTree(T->rchild);}}void InOrder(B 阅读全文
摘要:
// zzz.cpp //#include"zzz.h"void evaluation(string s){LinkStack S;InitStack(S);char ch;double a,b;istringstream iss(s);iss>>ch;while(ch!='#'){if(!OpMember(double(ch))) push_stack(S,(double)ch-'0');else{pop_stack(S,a); pop_stack(S,b);push_stack(S,operatorr(b,ch,a));}is 阅读全文
摘要:
// aaa.h //#include<iostream>using namespace std;typedef struct {int i,j,e;}Triple;typedef struct{Triple data[30];int mu,nu,tu;}TSMtatrix;TSMtatrix Init(TSMtatrix &M)//初始化三元组顺序表{M.mu=5;M.nu=5;M.tu=0;M.data[0].i=0;M.data[0].j=0;M.data[0].e=1;return M;}TSMtatrix houyi(TSMtatrix &M,int k) 阅读全文
摘要:
// bbb.h //#include<iostream>using namespace std;typedef struct {int * elem;int front;int rear;int queuesize;}sqQueue;void init_sq(sqQueue &q, int maxsize){q.elem=new int[maxsize-1];q.queuesize=maxsize;q.front=q.rear=0;}bool delete_sq(sqQueue &q , int & e){int m=0;for(int i=0;i< 阅读全文
摘要:
// hhh.cpp //#include"hhh.h"void transform(char *suffix , string s){LinkStack S;InitStack(S);char ch,c;push_stack(S,'#');istringstream iss(s);iss>>ch;int k=0; //cout<<"iss:"<<ch<<endl;while(!stackempty(S)){if(!OpMember(ch)) suffix[k++]=ch;//cout< 阅读全文
摘要:
//stack.h//#include<iostream>using namespace std;typedef int ElemType;typedef struct NodeType{ElemType data;NodeType *next;}NodeType,*LinkStack; void InitStack(LinkStack &S) //初始化栈{S=NULL;} //InitListbool pop_stack(LinkStack &S, ElemType &e) //出栈{NodeType *p;p=new NodeType;if(S){p= 阅读全文