error: no match for 'operator[]'

很简单的程序,只是使用了函数
定义部分
int a[500],e[500];
然后下面所有尝试对a数组进行操作的全部报错
a[p]=0;
a[p]++;等
错误提示:
rror: no match for 'operator[]' (operand types are 'QCoreApplication' and 'int')
a[p]++;
^
而且奇怪的是相同的e数组却没有错误提示(或者将a数组改掉之后就会出现错误提示了吧)

这是主函数部分
#include
#include"opencv2/imgproc/imgproc.hpp"
#include"opencv2/highgui/highgui.hpp"
#include
#include
//#include
#include
#include
#include
#include
#include
#include

using namespace std;
using namespace cv;

Mat marker_mask;
Mat markers;
Mat img0,img,img1,img2,img_propo_measure,img_gray,wshed,roi_circle,roi_circle2,res,marker_circle,marker_circle2;
Point prev_pt(-1,-1),pt2(-1,-1),prev_pt2(-1,-1),pt1(-1,-1),prev_pt1(-1,-1),center_of_circle(-1,-1);
int a[500],e[500];
double d[500],f[500];
int b=1,pixels=1;
double bound_num=0,comp_count;
double c=0,radius,roi_w,roi_h;
vectorx;
vector > storage;
vector contours;

void img_propo_measure_fun(int event,int,int,int,void*);
void on_mouse(int event,int,int,int,void*);
void on_mouse2(int event,int,int,int,void*);
void sortation();
void convertion_workoutG();
void output();

int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
if(argc==2&&(img0=imread(argv[1],1))!=0)
{

}
else
{
img0=imread("e:/codes/sample2.jpg");

}
string filemname="811.jpg";
RNG rng=RNG(-1);
namedWindow("image",1);
namedWindow("cut",1);
namedWindow("watershed transform",1);
namedWindow("proportion",1);

img=img0.clone();
img_propo_measure=img0.clone();

imshow("Proportion",img_propo_measure);
imshow("cut",img);
img1=img.clone();

setMouseCallback("Proportion",img_propo_measure_fun,0);
setMouseCallback("cut",on_mouse2,0);
setMouseCallback("image",on_mouse,0);
for(;;)
{
char c=waitKey();
if(c==27||c=='b')
break;
else if(c=='r')
{
//marker_mask=Mat::zeros();
img1.copyTo(img2);
imshow("image",img2);
}
else if(c=='w'||c==' ')
{
comp_count=1;
findContours(marker_mask,storage,&contours,CV_RETR_LIST,CV_CHAIN_APPROX_SIMPLE);
//markers=Mat::zeros();
for(int i;i //contours declaration is changed, trouble may be called,the next contours should be write as?
{
Scalar color=Scalar(rng.uniform(0,255),rng.uniform(0,255),rng.uniform(0,255));
drawContours(markers,contours,i,color,1,8,vector(),0,Point());

    }
    Mat color_tab(1,comp_count,CV_8UC3);
    for(int i=0;i<comp_count;i++)
    {
        uchar* ptr=color_tab.ptr<uchar>(i*3);
        ptr[0]=(uchar)(RNG::next(&rng)%180+50);//重置并返回32u的随机值
        ptr[1]=(uchar)(RNG::next(&rng)%180+50);
        ptr[2]=(uchar)(RNG::next(&rng)%180+50);

    }

    double t=(double)getTickCount();
    watered(res,markers);
    t=(double)getTickCount()-t;

    marker_circle=Mat::zeros(markers.size(),CV_32S);
    marker_circle2=Mat::zeros(markers.size(),CV_32S);
    bitwise_and(markers,markers,marker_circle,roi_circle);
    bitwise_and(markers,markers,marker_circle,roi_circle);

    for(int p=0;p<500;p++)
    {
        a[p]=0;
        e[p]=0;
    }
    int k=0;
    bound_num=0;

    for(int i=0;i<marker_circle2.rows;i++)
        for(int j=0;i<marker_circle2.cols-1;j++)
        {
            int n=0;
            int pres=CV_MAT_ELEM(marker_circle2,int,i,j);
            int next=CV_MAT_ELEM(marker_circle2,int,i,j+1);
            int sub=abs(pres-next);
            if(pres*next==0&&sub!=0)
            {
                for(n=0;n<k+1;n++)
                    if(e[n]==sub)
                        break;
                if(n==k+1)
                {
                    e[k]=sub;
                    bound_num++;
                    k++;
                }
            }
        }
    for(int i=0;i<marker_circle.rows;i++)
        for(int j=0;j<marker_circle.cols;j++)
        {
            int idx=CV_MAT_ELEM(marker_circle,int,i,j);
            for(int p=1;p<comp_count;p++)
            {
                if((idx-1)==b++)
                {
                    for(int boundary=0;boundary<k+1;boundary++)
                    {
                        if(e[boundary]==(b+1))
                            a[p]++;
                    }
                    a[p]++;
                    break;
                }
            }
            b=1;
            uchar* dst=&CV_MAT_ELEM(whed,uchar,i,j*3);
            if(idx==-1)
                dst[0]=dst[1]=dst[2]=(uchar)255;
            else if(idx<=0||idx>comp_count)
                dst[0]=dst[1]=dst[2]=(uchar)0;
            else
            {
                uchar* ptr=color_tab.ptr<uchar>(idx-1)*3;
                dst[0]=ptr[0];
                dst[1]=ptr[1];
                dst[2]=ptr[2];
            }
        }
    addWeighted(wshed,0.5,img_gray,0.5,0,wshed);
    imshow("watershed transform",wshed);





}

}
for(int i=1;i<comp_count;i++)
{
for(int j=i;j<comp_count;j++)
{
if(a[i]<a[j])
{
int temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
convertion_workoutG();
sortation();
output();
waitKey(0);

return a.exec();
}

4个回答

QCoreApplication a(argc, argv);
这是main函数第一句,请解释一下这个**a**是怎么回事!解释清楚了,你应该明白问题出在哪了!

Dandelion_fly
Dandelion_fly 非常感谢,原来是冲突了,阿里嘎多一
接近 5 年之前 回复
u012898195
COCOCOBoy 说白了,你在main函数里定义了一个名为a的QCoreApplication对象,于是全局的a数组被这个对象给隐藏了,要是用全局的a数组,请这样使用: (::a)
接近 5 年之前 回复

怎么看也不是这里的问题,有没有更详细的信息

这是主函数部分
#include
#include"opencv2/imgproc/imgproc.hpp"
#include"opencv2/highgui/highgui.hpp"
#include
#include
//#include
#include
#include
#include
#include
#include
#include

using namespace std;
using namespace cv;

Mat marker_mask;
Mat markers;
Mat img0,img,img1,img2,img_propo_measure,img_gray,wshed,roi_circle,roi_circle2,res,marker_circle,marker_circle2;
Point prev_pt(-1,-1),pt2(-1,-1),prev_pt2(-1,-1),pt1(-1,-1),prev_pt1(-1,-1),center_of_circle(-1,-1);
int a[500],e[500];
double d[500],f[500];
int b=1,pixels=1;
double bound_num=0,comp_count;
double c=0,radius,roi_w,roi_h;
vectorx;
vector > storage;
vector contours;

void img_propo_measure_fun(int event,int,int,int,void*);
void on_mouse(int event,int,int,int,void*);
void on_mouse2(int event,int,int,int,void*);
void sortation();
void convertion_workoutG();
void output();

int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
if(argc==2&&(img0=imread(argv[1],1))!=0)
{

}
else
{
    img0=imread("e:/codes/sample2.jpg");

}
string filemname="811.jpg";
RNG rng=RNG(-1);
namedWindow("image",1);
namedWindow("cut",1);
namedWindow("watershed transform",1);
namedWindow("proportion",1);

img=img0.clone();
img_propo_measure=img0.clone();

imshow("Proportion",img_propo_measure);
imshow("cut",img);
img1=img.clone();

setMouseCallback("Proportion",img_propo_measure_fun,0);
setMouseCallback("cut",on_mouse2,0);
setMouseCallback("image",on_mouse,0);
for(;;)
{
    char c=waitKey();
    if(c==27||c=='b')
        break;
    else if(c=='r')
    {
        //marker_mask=Mat::zeros();
        img1.copyTo(img2);
        imshow("image",img2);
    }
    else if(c=='w'||c==' ')
    {
        comp_count=1;
        findContours(marker_mask,storage,&contours,CV_RETR_LIST,CV_CHAIN_APPROX_SIMPLE);
        //markers=Mat::zeros();
        for(int i;i<contours.size();i++,comp_count++)
            //contours declaration is changed, trouble may be called,the next contours should be write as?
        {
            Scalar color=Scalar(rng.uniform(0,255),rng.uniform(0,255),rng.uniform(0,255));
            drawContours(markers,contours,i,color,1,8,vector<Vec4i>(),0,Point());

        }
        Mat color_tab(1,comp_count,CV_8UC3);
        for(int i=0;i<comp_count;i++)
        {
            uchar* ptr=color_tab.ptr<uchar>(i*3);
            ptr[0]=(uchar)(RNG::next(&rng)%180+50);//重置并返回32u的随机值
            ptr[1]=(uchar)(RNG::next(&rng)%180+50);
            ptr[2]=(uchar)(RNG::next(&rng)%180+50);

        }

        double t=(double)getTickCount();
        watered(res,markers);
        t=(double)getTickCount()-t;

        marker_circle=Mat::zeros(markers.size(),CV_32S);
        marker_circle2=Mat::zeros(markers.size(),CV_32S);
        bitwise_and(markers,markers,marker_circle,roi_circle);
        bitwise_and(markers,markers,marker_circle,roi_circle);

        for(int p=0;p<500;p++)
        {
            a[p]=0;
            e[p]=0;
        }
        int k=0;
        bound_num=0;

        for(int i=0;i<marker_circle2.rows;i++)
            for(int j=0;i<marker_circle2.cols-1;j++)
            {
                int n=0;
                int pres=CV_MAT_ELEM(marker_circle2,int,i,j);
                int next=CV_MAT_ELEM(marker_circle2,int,i,j+1);
                int sub=abs(pres-next);
                if(pres*next==0&&sub!=0)
                {
                    for(n=0;n<k+1;n++)
                        if(e[n]==sub)
                            break;
                    if(n==k+1)
                    {
                        e[k]=sub;
                        bound_num++;
                        k++;
                    }
                }
            }
        for(int i=0;i<marker_circle.rows;i++)
            for(int j=0;j<marker_circle.cols;j++)
            {
                int idx=CV_MAT_ELEM(marker_circle,int,i,j);
                for(int p=1;p<comp_count;p++)
                {
                    if((idx-1)==b++)
                    {
                        for(int boundary=0;boundary<k+1;boundary++)
                        {
                            if(e[boundary]==(b+1))
                                a[p]++;
                        }
                        a[p]++;
                        break;
                    }
                }
                b=1;
                uchar* dst=&CV_MAT_ELEM(whed,uchar,i,j*3);
                if(idx==-1)
                    dst[0]=dst[1]=dst[2]=(uchar)255;
                else if(idx<=0||idx>comp_count)
                    dst[0]=dst[1]=dst[2]=(uchar)0;
                else
                {
                    uchar* ptr=color_tab.ptr<uchar>(idx-1)*3;
                    dst[0]=ptr[0];
                    dst[1]=ptr[1];
                    dst[2]=ptr[2];
                }
            }
        addWeighted(wshed,0.5,img_gray,0.5,0,wshed);
        imshow("watershed transform",wshed);





    }
}
for(int i=1;i<comp_count;i++)
{
    for(int j=i;j<comp_count;j++)
    {
        if(a[i]<a[j])
        {
            int temp=a[i];
            a[i]=a[j];
            a[j]=temp;
        }
    }
}
convertion_workoutG();
sortation();
output();
waitKey(0);


return a.exec();

}

还有其他错误,打算一点点改,不过应该不会其他部分的错误导致这个错误吧

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
error: no match for ‘operator+’
报错如下:请问大佬们这个错误该如何修改可以编译通过啊 数据类型是: boost::unordered_map<string,int> Itt; boost::unordered_map<string,int>::iterator Itt_it; Int gid,Trd; 报错的行是: for(Itt_it=Itt.begin()+gid;Itt_it < Itt.end();Itt_it=Itt_it+Trd){ detect.cpp:857:62: error: no match for ‘operator+’ (operand types are ‘boost::unordered::unordered_map<std::__cxx11::basic_string<char>, int>::iterator {aka boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<std::pair<const std::__cxx11::basic_string<char>, int> > >}’ and ‘int’)
c语言写了个机房收费管理系统,编译出错
一堆出错提示都是error: no match for 'operator[]' (operand types are 'student' and 'int') 请问是什么意思?是什么引起的?求解
C++中系统类型与自定义类型隐式转换与重载函数参数是否引用有什么关系?
简单描述,当重载 + 号参数为非引用时可以实现隐式转换 但若加上引用符号则不行,求解? 错误提示: error: no match for 'operator+' (operand types are 'Complex' and 'double')| ``` #include <iostream> using namespace std; class Complex { public: Complex(){real=0,imag=0;} Complex(double r, double i){real=r, imag=i;} Complex operator - (Complex &c); Complex operator * (Complex &c); Complex operator / (Complex &c); Complex(double r){real=r,imag=0;} friend Complex operator+(Complex &c1, Complex &c2); //operator double(){return real;} void display(); private: double real; double imag; }; Complex Complex::operator*(Complex &c) { return (Complex(real*c.real, imag*c.imag)); } Complex Complex::operator/(Complex &c) { return (Complex(real/c.real, imag/c.imag)); } Complex Complex::operator-(Complex &c) { return (Complex(real-c.real, imag-c.imag)); } void Complex::display() { cout <<"(" <<real <<"," <<imag <<"i)" <<endl; } Complex operator + (Complex &c1,Complex &c2) { return (Complex(c1.real+c2.real, c1.imag+c2.imag)); } int main(void) { Complex c1(2,4), c2(3,6), c3; double i = 7.0; c1.display(), c2.display(); c3 = c2 + i; c3.display(); c3 = c2 - c1; c3.display(); c3 = c2 * c1; c3.display(); c3 = c2 / c1; c3.display(); return 0; } ```
关于C++ vector 的问题
``` 请问下列代码错在哪里? #include<iostream> #include<vector> #include<string> using std::vector; using namespace std; int main() { int word; vector<int> var; vector<int> res_var; cout << "Please enter a group numbers:" << endl; while (cin >> word){ var.push_back(word); for (vector<int>::size_type i = 0; i != (var.size()-1); i = i + 2){ res_var = var[i] + var[i+1]; cout << res_var << " ; " ; } if (var.size() % 2 = 1) cout << "The last one no add." << endl; } return 0; } 错误信息: [Error] no match for 'operator=' (operand types are 'std::vector<int>' and 'int') [Error] no match for 'operator<<' (operand types are 'std::ostream {aka std::basic_ostream<char>}' and 'std::vector<int>') ```
程序无法启动。。。系统找不到指定文件
#include"stdafx.h" #include<afx.h> #include <opencv2/opencv.hpp> #include <iostream> using namespace cv; using namespace std; int main(){ CString abPath = "C:\\Profram Files\\feiq\\Recv Files\\ACSImage\\cache\\v3.2\\代表图"; getFile(abPath); } void changeSize(CString cs_abPath,string abSavePath,CString fileName){ Mat img = imread(cs_abPath.GetBuffer); Mat dst; string savePath = abSavePath +"\\" +fileName.GetBuffer+".jpg"; double scale; int img_height = img.rows; scale = 400.0/ img_height; resize(img, dst, Size(0, 0), scale, scale); imwrite(savePath,dst); } void getFile(CString pathStr){ CString myDataPath, fdPath; myDataPath =pathStr+"\\*.*"; CFileFind finder; boolean buffer = finder.FindFile(myDataPath); string abSavePath = "C:\\Profram Files\\feiq\\Recv Files\\ACSImage\\cache\\v3.2\\代表图小图"; while (buffer) { buffer = finder.FindNextFileW(); if (!finder.IsDots){ /*fdPath是当前的路径, 判断: 如果当前这个路径下是文件夹 递归(fdPath) 如果当前这个路径下是文件 则调changeSize() 多个文件的可以吗?? 保存文件的路径怎么办?? 逻辑上还是有问题 */ fdPath = finder.GetFilePath; if (finder.IsDirectory) { getFile(fdPath); } else { changeSize(fdPath, abSavePath, finder.GetFileName()); } } } finder.Close(); } 代码如上 win32AP 我想不用MFC然后调用MFC里的一些类, 出现题目所示问题. 1>------ Build started: Project: opencvTestBYljk, Configuration: Debug Win32 ------ 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(364,5): warning MSB8004: Output Directory does not end with a trailing slash. This build instance will add the slash as it is required to allow proper evaluation of the Output Directory. 1> opencvTestBYljk.cpp 1>d:\lx\home\proj\cuda\opencvtestbyljk\opencvtestbyljk\opencvtestbyljk.cpp(10): error C3861: 'getFile': identifier not found 1>d:\lx\home\proj\cuda\opencvtestbyljk\opencvtestbyljk\opencvtestbyljk.cpp(13): error C3867: 'ATL::CSimpleStringT<wchar_t,true>::GetBuffer': function call missing argument list; use '&ATL::CSimpleStringT<wchar_t,true>::GetBuffer' to create a pointer to member 1>d:\lx\home\proj\cuda\opencvtestbyljk\opencvtestbyljk\opencvtestbyljk.cpp(15): error C2678: binary '+' : no operator found which takes a left-hand operand of type 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' (or there is no acceptable conversion) 1> d:\opencv249\opencv\build\include\opencv2\core\mat.hpp(2001): could be 'cv::MatConstIterator cv::operator +(ptrdiff_t,const cv::MatConstIterator &)' 1> d:\opencv249\opencv\build\include\opencv2\core\mat.hpp(1998): or 'cv::MatConstIterator cv::operator +(const cv::MatConstIterator &,ptrdiff_t)' 1> d:\opencv249\opencv\build\include\opencv2\core\mat.hpp(1268): or 'cv::MatExpr cv::operator +(const cv::MatExpr &,const cv::MatExpr &)' 1> d:\opencv249\opencv\build\include\opencv2\core\mat.hpp(1267): or 'cv::MatExpr cv::operator +(const cv::Scalar &,const cv::MatExpr &)' 1> d:\opencv249\opencv\build\include\opencv2\core\mat.hpp(1266): or 'cv::MatExpr cv::operator +(const cv::MatExpr &,const cv::Scalar &)' 1> d:\opencv249\opencv\build\include\opencv2\core\mat.hpp(1265): or 'cv::MatExpr cv::operator +(const cv::Mat &,const cv::MatExpr &)' 1> d:\opencv249\opencv\build\include\opencv2\core\mat.hpp(1264): or 'cv::MatExpr cv::operator +(const cv::MatExpr &,const cv::Mat &)' 1> d:\opencv249\opencv\build\include\opencv2\core\mat.hpp(1263): or 'cv::MatExpr cv::operator +(const cv::Scalar &,const cv::Mat &)' 1> d:\opencv249\opencv\build\include\opencv2\core\mat.hpp(1262): or 'cv::MatExpr cv::operator +(const cv::Mat &,const cv::Scalar &)' 1> d:\opencv249\opencv\build\include\opencv2\core\mat.hpp(1261): or 'cv::MatExpr cv::operator +(const cv::Mat &,const cv::Mat &)' 1> d:\opencv249\opencv\build\include\opencv2\core\operations.hpp(2248): or 'cv::Range cv::operator +(int,const cv::Range &)' 1> d:\opencv249\opencv\build\include\opencv2\core\operations.hpp(2243): or 'cv::Range cv::operator +(const cv::Range &,int)' 1> while trying to match the argument list '(std::basic_string<char,std::char_traits<char>,std::allocator<char>>, overloaded-function)' 1>d:\lx\home\proj\cuda\opencvtestbyljk\opencvtestbyljk\opencvtestbyljk.cpp(31): error C2276: '!' : illegal operation on bound member function expression 1>d:\lx\home\proj\cuda\opencvtestbyljk\opencvtestbyljk\opencvtestbyljk.cpp(40): error C3867: 'CFileFind::GetFilePath': function call missing argument list; use '&CFileFind::GetFilePath' to create a pointer to member 1>d:\lx\home\proj\cuda\opencvtestbyljk\opencvtestbyljk\opencvtestbyljk.cpp(40): error C2679: binary '=' : no operator found which takes a right-hand operand of type 'overloaded-function' (or there is no acceptable conversion) 1> d:\program files (x86)\microsoft visual studio 12.0\vc\atlmfc\include\cstringt.h(1322): could be 'ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>> &ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>>::operator =(const VARIANT &)' 1> d:\program files (x86)\microsoft visual studio 12.0\vc\atlmfc\include\cstringt.h(1314): or 'ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>> &ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>>::operator =(char)' 1> d:\program files (x86)\microsoft visual studio 12.0\vc\atlmfc\include\cstringt.h(1305): or 'ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>> &ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>>::operator =(wchar_t)' 1> d:\program files (x86)\microsoft visual studio 12.0\vc\atlmfc\include\cstringt.h(1299): or 'ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>> &ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>>::operator =(const unsigned char *)' 1> d:\program files (x86)\microsoft visual studio 12.0\vc\atlmfc\include\cstringt.h(1281): or 'ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>> &ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>>::operator =(const char *)' 1> d:\program files (x86)\microsoft visual studio 12.0\vc\atlmfc\include\cstringt.h(1273): or 'ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>> &ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>>::operator =(const wchar_t *)' 1> d:\program files (x86)\microsoft visual studio 12.0\vc\atlmfc\include\cstringt.h(1258): or 'ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>> &ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>>::operator =(const ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>> &)' 1> while trying to match the argument list '(CString, overloaded-function)' 1>d:\lx\home\proj\cuda\opencvtestbyljk\opencvtestbyljk\opencvtestbyljk.cpp(41): error C3867: 'CFileFind::IsDirectory': function call missing argument list; use '&CFileFind::IsDirectory' to create a pointer to member
有关c++vector中元素类型的问题
昨天做比赛的时候发现了一个奇怪bug,下面是我写的一个测试程序, 运行后会显示: ``` [Error] no match for 'operator==' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<node> >::value_type {aka node}' and 'node') ``` 环境是Dev 5.11,这判断符两边的数据类型是一样的啊,为什么会报错?求解答 ``` #include <iostream> #include <vector> using namespace std; struct node { int k; }; int main() { vector<node>a(7); a[3].k=0; node t; t.k=0; if(a[3]==t) { cout<<"1"; } else { cout<<"0"; } } ```
c++ map<string,int> 用下标访问的时候报错的问题?
``` #include<iostream> #include<string> #include<vector> #include<map> #include<algorithm> using namespace std; map<string,int> m; vector<int> v; int index=1; int main(){ int n,k; cin>>n>>k; for(int i=0;i<k;i++){ int course,m; cin>>course>>m; for(int j=0;j<m;j++){ string s; cin>>s; if(m[s]!=0){ v[m[s]].push_back(course); }else { m[s]=index; index++; v[m[s]].push_back(course); } } } } ``` 报错 22 10 D:\Dev C++\workspace\A1039.cpp [Error] no match for 'operator[]' in 'm[s]' 每一次用下标访问m[s]的时候都会报错
class的一个古怪问题,这是怎么回事?
各位大佬来帮一下我这位菜鸟吧!!!! 我在编程时弄了一个class 如下: ``` struct bowpicture { string a[15]; }; ``` 再如此定义: ``` bowpicture p[21]; ``` 再这样赋值: ``` p[1]={" |\ " " | \ " " | | " " | /" " |/"}; ``` 再输出: ``` for(int i=0;i<6;i++); { cout<<p[1][i]; } ``` 它就会报错: ``` 190 12 F:\arrow.exe\arrow.cpp [Error] no match for 'operator[]' (operand types are 'bowpicture' and 'int') ``` 请各路大侠出手相助 告诉我这是怎么回事 我会感谢你们所有人的
重载运算符类型不匹配
#ifndef DAT_H_INCLUDED #define DAT_H_INCLUDED #include<istream> #include<ostream> #include<iostream> using namespace std; class date { private: int year; int month; int day; int dton(date &a); //将指定日期转换成从0年O月O日起的天数 date ntod(int b); //将指定的0年O月O日起的天数转换成对应的日期 bool leap(int year); public: date(); date(int y,int m,int d); friend istream &operator >> (istream &is,date &d); friend ostream &operator << (ostream &os,date &d); date operator +(int &days); date operator -(int &days); int operator -(date &da); void operator =(date &da); int dt(date &a); date nt(int b); bool le(int year); ~date(); }; #endif // DAT_H_INCLUDED ``` #include"dat.h" #include<istream> #include<ostream> #include<iostream> using namespace std; static int day_tab[2][12] = {{31,28,31,30,3l,30,3l,3l,30,31,30,31}, {31,29,31,30,31,30,31,31,30,31,30,31}}; date::date() { year = 0; month = 1; day = 1; } date::date(int y,int m,int d) { year = y; month = m; day = d; } istream &operator >> (istream &is,date &d) { cin >> d.year >> d.month >> d.day; return is; } ostream &operator << (ostream &os,date &d) { cout << d.year << "." << d.month << "." << d.day << endl; return os; } bool date::leap(int year) { if((year % 4 == 0 && year % 100 != 0)||year % 400 == 0) return true; else return false; } date date::operator +(int &days) { int rest; rest = this->dt(*this) + days; return this->nt(rest); } int date::dton(date &a) { int ye,mo,da=0; for(ye = 0;ye < a.year;ye++) { if(a.le(a.year)) da += 366; else da += 365; } for(mo = 0;mo < a.month-1;mo++) { if(a.le(a.year)) da += day_tab[0][mo]; else da += day_tab[1][mo]; } da += a.day; return da; } date date::ntod(int b) { date a(0,1,1); int rest = b; while(1) { if(a.le(a.year)) { rest -= 366; if(rest < 0) { rest += 366; break; } a.year++; } else { rest -= 365; if(rest < 0) { rest += 365; break; } a.year++; } } while(1) { if(a.le(a.year)) { for(int i = 0;i < 12;i++) { rest -= day_tab[0][i]; if(rest < 0) { rest += day_tab[0][i]; break; } a.month++; } } else { for(int i = 0;i < 12;i++) { rest -= day_tab[1][i]; if(rest < 0) { rest += day_tab[1][i]; break; } a.month++; } } break; } a.day = rest; return a; } date date::operator -(int &days) { int da; da = this->dt(*this) - days; return this->nt(da); } int date::operator -(date &da) { int rest; rest = this->dt(*this) - da.dt(da); return rest; } int date::dt(date &a) { return dton(a); } date date::nt(int b) { return ntod(b); } bool date::le(int year) { return leap(year); } void date::operator =(date &da) { this->year = da.year; this->month = da.month; this->day = da.day; } date::~date() { } #include<iostream> #include<ostream> #include<windows.h> #include"dat.h" using namespace std; int main() { while(1) { date *p = new date; cout << "请输入日期:" << endl; cin >> *p; int n; cout << "请选择功能:" << endl; cout << "1.将日期转化为天数\n" << "2.两日期相差天数\n" << "3.计算所加天数后日期\n" << "4.计算所减天数后日期\n" << "5.将天数转化为日期\n" << "6.退出" << endl; cin >> n; while(n<1||n>6) { cout << "输入错误,请重新选择功能" << endl; n = 0; cin >> n; } system("cls"); switch(n) { case 1: { cout << p->dt(*p) << endl; system("pause"); system("cls"); break; } case 2: { date *q = new date; cout << "请输入日期:" << endl; cin >> *q; cout << *p - *q << endl; system("pause"); system("cls"); delete q; break; } case 3: { cout << "请输入天数:" << endl; int m; cin >> m; cout << *p + m << endl; system("pause"); system("cls"); break; } case 4: { cout << "请输入天数:" << endl; int k; cin >> k; cout << (*p - k) << endl; system("pause"); system("cls"); break; } case 5: { cout << "请输入天数:" << endl; int u; cin >> u; date q = p->nt(u); cout << q << endl; system("pause"); system("cls"); break; } case 6:exit(0); } } } 报错: ||=== Build: Debug in Date (compiler: GNU GCC Compiler) ===| D:\C++学习\Date\main.cpp||In function 'int main()':| D:\C++学习\Date\main.cpp|65|error: no match for 'operator<<' in 'std::cout << date::operator-(const int&)(((const int&)((const int*)(& k))))'| d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\ostream|108|note: candidates are: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>& (*)(std::basic_ostream<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]| d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\ostream|117|note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ios<_CharT, _Traits>& (*)(std::basic_ios<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]| d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\ostream|127|note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char, _Traits = std::char_traits<char>]| d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\ostream|165|note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char, _Traits = std::char_traits<char>]| d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\ostream|169|note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char, _Traits = std::char_traits<char>]| d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\ostream|173|note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char, _Traits = std::char_traits<char>]| d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\bits\ostream.tcc|91|note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char, _Traits = std::char_traits<char>]| d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\ostream|180|note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char, _Traits = std::char_traits<char>]| d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\bits\ostream.tcc|105|note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char, _Traits = std::char_traits<char>]| d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\ostream|191|note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char, _Traits = std::char_traits<char>]| d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\ostream|200|note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char, _Traits = std::char_traits<char>]| d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\ostream|204|note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char, _Traits = std::char_traits<char>]| d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\ostream|209|note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char, _Traits = std::char_traits<char>]| d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\ostream|213|note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char, _Traits = std::char_traits<char>]| d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\ostream|221|note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char, _Traits = std::char_traits<char>]| d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\ostream|225|note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char, _Traits = std::char_traits<char>]| d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\bits\ostream.tcc|119|note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_streambuf<_CharT, _Traits>*) [with _CharT = char, _Traits = std::char_traits<char>]| D:\C++学习\Date\dat.h|21|note: std::ostream& operator<<(std::ostream&, date&)| ||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
下面的错误怎么改啊,请大家帮帮我,我刚开始写,写不好啊。耐心看一下,谢谢!!
``` #include <iostream> #include <string> #define MAX 100 using namespace std; class HTNode { public: int weight; string data; int f; HTNode* father; HTNode* lchild; HTNode* rchild; string code; HTNode() { weight=0; data='0'; code='0'; f=0; father=NULL; lchild=NULL; rchild=NULL; } void SetChild (HTNode* lchild, HTNode* rchild) { this->lchild = lchild; this->rchild = rchild; } void SetF(int f) { this->f = f; } void SetFather(HTNode* father) { this->father = father; } }; void SelectMin(HTNode*ht[], int*a1,int*a2) { int min1=0; int min2=0; for(int i=0;i<2*MAX-1;i++) { if(ht[min1]->weight>ht[i]->weight) min1=i; } min2=min1+1; for(int i=0;i<2*MAX-1;i++) { if(ht[min2]->weight>ht[i]->weight) min2=i; } *a1=min1; *a2=min2; } void Printtree(HTNode* root, int n) { if (root==NULL) return; for (int i=0;i<n;i++) { cout<<" "; } if (root->f==1) { cout<<"|_"; } else { cout<<" "; } cout<<root->data<<endl; Printtree(root->lchild, n+2); Printtree(root->rchild, n+2); } void Bianma(HTNode*ht[]) { HTNode* curr; string* code = new string[MAX]; for (int i = 0; i < MAX ; i++) { code[i] = '2'; } for (int i = 0; i < MAX; i++) { int j = 1; cout<<ht[i]->data<<"的哈弗曼编码为:"; curr = ht[i]; while (curr->f==1) { curr=curr->father; if (curr->f==1){ code[j++]=curr->code; } } code[0] = ht[i]->code; string c[j]; int count = 0; for (int l = j-1; l >=0; l--) { if (code[l]!= '2') { c[count++] = code[l]; } } for (int x = 0; x < j; x++) { ht[i]->code += c[x]; } cout<<ht[i]->code<<endl; cout<<endl; } } void FanYi(HTNode* ht[]) { string code; string test = ""; HTNode* curr; HTNode* root; cout<<"请输入编码:"<<endl; cin>>code; int n = code.length(); string* cs = new string[n]; code.copy(cs, n, 0); for (int i = 0; i < MAX*2-1; i++) { if (ht[i]->f == 0) { root = ht[i]; } } curr = root; for (int i = 0; i < n; i++) { if (cs[i] == '0' && curr->lchild != NULL) { curr = curr->lchild; test += '0'; } else if (cs[i] == '1') { curr = curr->rchild; test += '1'; } if (curr->lchild == NULL || curr->rchild == NULL) { curr = root; for (int i = 0; i < MAX; i++) { if (ht[i]->code == test) { cout<<ht[i]->data; test = ""; } } } } cout<<endl; } void GouJian(string* s, int* n) { int a1, a2, m; m = 2*MAX-1; HTNode* ht[2*MAX-1]; for (int i=0;i<MAX;i++) { ht[i] = new HTNode(s[i], n[i]); } for (int i=MAX;i<2*MAX-1;i++) { ht[i] = new HTNode('0'); } for (int i = 0; i < MAX-1; i++) { SelectMin(ht, &a1, &a2); ht[MAX+i]->weight = ht[a1]->weight + ht[a2]->weight; if (ht[a1]->weight <= ht[a2]->weight) { ht[MAX+i]->SetChild(ht[a1], ht[a2]); ht[a1]->code = '0'; ht[a2]->code = '1'; } else { ht[MAX+i]->SetChild(ht[a2], ht[a1]); ht[a1]->code = '1'; ht[a2]->code = '0'; } ht[a1]->SetF(1); ht[a2]->SetF(1); ht[a1]->SetFather(ht[MAX+i]); ht[a2]->SetFather(ht[MAX+i]); for (int i=0;i<2*MAX-1;i++) { cout<<ht[i]->weight<<" "; } cout<<endl; } cout<<"您输入的哈夫曼树为:"<<endl<<endl; for (int i = 0;i<2*MAX-1;i++) { if (ht[i]->father == 0) { Printtree(ht[i], MAX); cout<<endl; } } cout<<"根据系统分析,有以下结论:"<<endl; Bianma(ht); cout<<endl; FanYi(ht); } ``` 错误信息 error: no matching function for call to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::copy(std::string*&, int&, int)' error: no match for 'operator!=' in '*((+(((unsigned int)l) * 4u)) + code) != '2' error: no matching function for call to `HTNode::HTNode(char)'
求各位大神解决systemc函数运行时间计算问题
#include "pe.h" void PE_base::set_xy(int x, int y) { assert((x_ == -1) && (y_ == -1)); // set once only assert((x != -1) && (y != -1)); // must use a legal location x_ = x; y_ = y; } void PE_base::read_input() { r+=1; packet_in_ = data_in.read(); } void PE_base::write_output() { if (out_queue_.empty()) { data_out.write(packet()); } else { data_out.write(out_queue_.front()); out_queue_.pop_front(); } } void PE_IO::execute() { // decide if we are going to fire PI int r = rand()%100; if (r < 80) //a=clock(); fire_PI(); //b=clock(); totaltime=(double)(b-a)/CLOCKS_PER_SEC; printf("TIME is %d\n", totaltime); // fire PO if the incoming packet is valid if ((packet_in_.src_x != -1) && (packet_in_.src_y != -1)) //a=clock(); fire_PO(); //b=clock(); totaltime=(double)(b-a)/CLOCKS_PER_SEC; printf("TIME is %d\n", totaltime); } void PE_IO::fire_PI() { for(int i=1;i<=2;i++){ int P1_x = i, P1_y = 0; packet p(x_, y_, P1_x, P1_y, rand()%100); printf("PI: send %d to (%d,%d)\n", p.token, p.dest_x, p.dest_y); out_queue_.push_back(p); } } void PE_IO::fire_PO() { assert((packet_in_.src_x != -1) && (packet_in_.src_y != -1)); printf("PO: receive %d from (%d,%d)\n", packet_in_.token, packet_in_.src_x, packet_in_.src_y); } void PE_inc::execute() { // fire the actor if the incoming packet is valid if ((packet_in_.src_x != -1) && (packet_in_.src_y != -1)) //a=clock(); fire(); //b=clock(); } void PE_inc::fire() { assert((packet_in_.src_x != -1) && (packet_in_.src_y != -1)); int PO_x = 0, PO_y = 0; packet p(x_, y_, PO_x, PO_y, packet_in_.token+1); printf("inc(%d,%d): receive %d from (%d,%d), send %d to (%d,%d)\n", x_, y_, packet_in_.token, packet_in_.src_x, packet_in_.src_y, p.token, p.dest_x, p.dest_y); out_queue_.push_back(p); } void PE_incs::execute() { // fire the actor if the incoming packet is valid if ((packet_in_.src_x != -1) && (packet_in_.src_y != -1)) //a=clock(); fire(); //b=clock(); } void PE_incs::fire() { assert((packet_in_.src_x != -1) && (packet_in_.src_y != -1)); int PO_x = 0, PO_y = 0; packet p(x_, y_, PO_x, PO_y, packet_in_.token+1); printf("inc(%d,%d): receive %d from (%d,%d), send %d to (%d,%d)\n", x_, y_, packet_in_.token, packet_in_.src_x, packet_in_.src_y, p.token, p.dest_x, p.dest_y); out_queue_.push_back(p); } ----------------------------------------------------------------------------------- 希望在execute()中计算fire函数的运行时间,但是报错 ../ece587-src/pe.cpp:82: error: no match for call to ‘(sc_core::sc_in<bool>) ()’ ../systemc-2.2.0/src/sysc/communication/sc_signal_ports.h:466: note: candidates are: void sc_core::sc_in<bool>::operator()(const sc_core::sc_signal_in_if<bool>&) ../systemc-2.2.0/src/sysc/communication/sc_signal_ports.h:475: note: void sc_core::sc_in<bool>::operator()(sc_core::sc_port<sc_core::sc_signal_in_if<bool>, 1, SC_ONE_OR_MORE_BOUND>&) ../systemc-2.2.0/src/sysc/communication/sc_signal_ports.h:484: note: void sc_core::sc_in<bool>::operator()(sc_core::sc_port<sc_core::sc_signal_inout_if<bool>, 1, SC_ONE_OR_MORE_BOUND>&) --------------------------------------------------------------------- 求大神解答,对systemc真心不懂
搭建好服务器之后,启动服务器
搭建好服务器之后,启动服务器,出现: DEBUG response status: 404 :/home/tclxa/.virtualenvs/zamboni/lib/python2.6/site-packages/pyelasticsearch/client.py:252 cilent.py文件如下: # -*- coding: utf-8 -*- from __future__ import absolute_import from datetime import datetime from operator import itemgetter from functools import wraps from logging import getLogger import re from six import (iterkeys, binary_type, text_type, string_types, integer_types, iteritems, PY3) from six.moves import xrange try: # PY3 from urllib.parse import urlencode, quote_plus except ImportError: # PY2 from urllib import urlencode, quote_plus import requests import simplejson as json # for use_decimal from simplejson import JSONDecodeError from pyelasticsearch.downtime import DowntimePronePool from pyelasticsearch.exceptions import (Timeout, ConnectionError, ElasticHttpError, InvalidJsonResponseError, ElasticHttpNotFoundError, IndexAlreadyExistsError) def _add_es_kwarg_docs(params, method): """ Add stub documentation for any args in ``params`` that aren't already in the docstring of ``method``. The stubs may not tell much about each arg, but they serve the important purpose of letting the user know that they're safe to use--we won't be paving over them in the future for something pyelasticsearch-specific. """ def docs_for_kwarg(p): return '\n :arg %s: See the ES docs.' % p doc = method.__doc__ if doc is not None: # It's none under python -OO. # Handle the case where there are no :arg declarations to key off: if '\n :arg' not in doc and params: first_param, params = params[0], params[1:] doc = doc.replace('\n (Insert es_kwargs here.)', docs_for_kwarg(first_param)) for p in params: if ('\n :arg %s: ' % p) not in doc: # Find the last documented arg so we can put our generated docs # after it. No need to explicitly compile this; the regex cache # should serve. insertion_point = re.search( r' :arg (.*?)(?=\n+ (?:$|[^: ]))', doc, re.MULTILINE | re.DOTALL).end() doc = ''.join([doc[:insertion_point], docs_for_kwarg(p), doc[insertion_point:]]) method.__doc__ = doc def es_kwargs(*args_to_convert): """ Mark which kwargs will become query string params in the eventual ES call. Return a decorator that grabs the kwargs of the given names, plus any beginning with "es_", subtracts them from the ordinary kwargs, and passes them to the decorated function through the ``query_params`` kwarg. The remaining kwargs and the args are passed through unscathed. Also, if any of the given kwargs are undocumented in the decorated method's docstring, add stub documentation for them. """ convertible_args = set(args_to_convert) def decorator(func): # Add docs for any missing query params: _add_es_kwarg_docs(args_to_convert, func) @wraps(func) def decorate(*args, **kwargs): # Make kwargs the map of normal kwargs and query_params the map of # kwargs destined for query string params: query_params = {} for k in list(iterkeys(kwargs)): # Make a copy; we mutate kwargs. if k.startswith('es_'): query_params[k[3:]] = kwargs.pop(k) elif k in convertible_args: query_params[k] = kwargs.pop(k) return func(*args, query_params=query_params, **kwargs) return decorate return decorator class ElasticSearch(object): """ An object which manages connections to elasticsearch and acts as a go-between for API calls to it This object is thread-safe. You can create one instance and share it among all threads. """ def __init__(self, urls, timeout=60, max_retries=0, revival_delay=300): """ :arg urls: A URL or iterable of URLs of ES nodes. These are full URLs with port numbers, like ``http://elasticsearch.example.com:9200``. :arg timeout: Number of seconds to wait for each request before raising Timeout :arg max_retries: How many other servers to try, in series, after a request times out or a connection fails :arg revival_delay: Number of seconds for which to avoid a server after it times out or is uncontactable """ if isinstance(urls, string_types): urls = [urls] urls = [u.rstrip('/') for u in urls] self.servers = DowntimePronePool(urls, revival_delay) self.revival_delay = revival_delay self.timeout = timeout self.max_retries = max_retries self.logger = getLogger('pyelasticsearch') self.session = requests.session() self.json_encoder = JsonEncoder def _concat(self, items): """ Return a comma-delimited concatenation of the elements of ``items``, with any occurrences of "_all" omitted. If ``items`` is a string, promote it to a 1-item list. """ # TODO: Why strip out _all? if items is None: return '' if isinstance(items, string_types): items = [items] return ','.join(i for i in items if i != '_all') def _to_query(self, obj): """ Convert a native-Python object to a unicode or bytestring representation suitable for a query string. """ # Quick and dirty thus far if isinstance(obj, string_types): return obj if isinstance(obj, bool): return 'true' if obj else 'false' if isinstance(obj, integer_types): return str(obj) if isinstance(obj, float): return repr(obj) # str loses precision. if isinstance(obj, (list, tuple)): return ','.join(self._to_query(o) for o in obj) iso = _iso_datetime(obj) if iso: return iso raise TypeError("_to_query() doesn't know how to represent %r in an ES" ' query string.' % obj) def _utf8(self, thing): """Convert any arbitrary ``thing`` to a utf-8 bytestring.""" if isinstance(thing, binary_type): return thing if not isinstance(thing, text_type): thing = text_type(thing) return thing.encode('utf-8') def _join_path(self, path_components): """ Smush together the path components, omitting '' and None ones. Unicodes get encoded to strings via utf-8. Incoming strings are assumed to be utf-8-encoded already. """ path = '/'.join(quote_plus(self._utf8(p), '') for p in path_components if p is not None and p != '') if not path.startswith('/'): path = '/' + path return path def send_request(self, method, path_components, body='', query_params=None, encode_body=True): """ Send an HTTP request to ES, and return the JSON-decoded response. This is mostly an internal method, but it also comes in handy if you need to use a brand new ES API that isn't yet explicitly supported by pyelasticsearch, while still taking advantage of our connection pooling and retrying. Retry the request on different servers if the first one is down and ``self.max_retries`` > 0. :arg method: An HTTP method, like "GET" :arg path_components: An iterable of path components, to be joined by "/" :arg body: The request body :arg query_params: A map of querystring param names to values or ``None`` :arg encode_body: Whether to encode the body of the request as JSON """ path = self._join_path(path_components) if query_params: path = '?'.join( [path, urlencode(dict((k, self._utf8(self._to_query(v))) for k, v in iteritems(query_params)))]) request_body = self._encode_json(body) if encode_body else body req_method = getattr(self.session, method.lower()) # We do our own retrying rather than using urllib3's; we want to retry # a different node in the cluster if possible, not the same one again # (which may be down). for attempt in xrange(self.max_retries + 1): server_url, was_dead = self.servers.get() url = server_url + path self.logger.debug( "Making a request equivalent to this: curl -X%s '%s' -d '%s'", method, url, request_body) try: resp = req_method( url, timeout=self.timeout, **({'data': request_body} if body else {})) except (ConnectionError, Timeout): self.servers.mark_dead(server_url) self.logger.info('%s marked as dead for %s seconds.', server_url, self.revival_delay) if attempt >= self.max_retries: raise else: if was_dead: self.servers.mark_live(server_url) break self.logger.debug('response status: %s', resp.status_code) print'****************************************************' print resp.status_code print'****************************************************' prepped_response = self._decode_response(resp) if resp.status_code >= 400: self._raise_exception(resp, prepped_response) self.logger.debug('got response %s', prepped_response) return prepped_response def _raise_exception(self, response, decoded_body): """Raise an exception based on an error-indicating response from ES.""" error_message = decoded_body.get('error', decoded_body) error_class = ElasticHttpError if response.status_code == 404: error_class = ElasticHttpNotFoundError elif (error_message.startswith('IndexAlreadyExistsException') or 'nested: IndexAlreadyExistsException' in error_message): error_class = IndexAlreadyExistsError raise error_class(response.status_code, error_message) def _encode_json(self, value): """ Convert a Python value to a form suitable for ElasticSearch's JSON DSL. """ return json.dumps(value, cls=self.json_encoder, use_decimal=True) def _decode_response(self, response): """Return a native-Python representation of a response's JSON blob.""" try: json_response = response.json() except JSONDecodeError: raise InvalidJsonResponseError(response) return json_response ## REST API @es_kwargs('routing', 'parent', 'timestamp', 'ttl', 'percolate', 'consistency', 'replication', 'refresh', 'timeout', 'fields') def index(self, index, doc_type, doc, id=None, overwrite_existing=True, query_params=None): """ Put a typed JSON document into a specific index to make it searchable. :arg index: The name of the index to which to add the document :arg doc_type: The type of the document :arg doc: A Python mapping object, convertible to JSON, representing the document :arg id: The ID to give the document. Leave blank to make one up. :arg overwrite_existing: Whether we should overwrite existing documents of the same ID and doctype :arg routing: A value hashed to determine which shard this indexing request is routed to :arg parent: The ID of a parent document, which leads this document to be routed to the same shard as the parent, unless ``routing`` overrides it. :arg timestamp: An explicit value for the (typically automatic) timestamp associated with a document, for use with ``ttl`` and such :arg ttl: The time until this document is automatically removed from the index. Can be an integral number of milliseconds or a duration like '1d'. :arg percolate: An indication of which percolator queries, registered against this index, should be checked against the new document: '*' or a query string like 'color:green' :arg consistency: An indication of how many active shards the contact node should demand to see in order to let the index operation succeed: 'one', 'quorum', or 'all' :arg replication: Set to 'async' to return from ES before finishing replication. :arg refresh: Pass True to refresh the index after adding the document. :arg timeout: A duration to wait for the relevant primary shard to become available, in the event that it isn't: for example, "5m" See `ES's index API`_ for more detail. .. _`ES's index API`: http://www.elasticsearch.org/guide/reference/api/index_.html """ # :arg query_params: A map of other querystring params to pass along to # ES. This lets you use future ES features without waiting for an # update to pyelasticsearch. If we just used **kwargs for this, ES # could start using a querystring param that we already used as a # kwarg, and we'd shadow it. Name these params according to the names # they have in ES's REST API, but prepend "\es_": for example, # ``es_version=2``. # TODO: Support version along with associated "preference" and # "version_type" params. if not overwrite_existing: query_params['op_type'] = 'create' return self.send_request('POST' if id is None else 'PUT', [index, doc_type, id], doc, query_params) @es_kwargs('consistency', 'refresh') def bulk_index(self, index, doc_type, docs, id_field='id', parent_field='_parent', query_params=None): """ Index a list of documents as efficiently as possible. :arg index: The name of the index to which to add the document :arg doc_type: The type of the document :arg docs: An iterable of Python mapping objects, convertible to JSON, representing documents to index :arg id_field: The field of each document that holds its ID :arg parent_field: The field of each document that holds its parent ID, if any. Removed from document before indexing. See `ES's bulk API`_ for more detail. .. _`ES's bulk API`: http://www.elasticsearch.org/guide/reference/api/bulk.html """ body_bits = [] if not docs: raise ValueError('No documents provided for bulk indexing!') for doc in docs: action = {'index': {'_index': index, '_type': doc_type}} if doc.get(id_field) is not None: action['index']['_id'] = doc[id_field] if doc.get(parent_field) is not None: action['index']['_parent'] = doc.pop(parent_field) body_bits.append(self._encode_json(action)) body_bits.append(self._encode_json(doc)) # Need the trailing newline. body = '\n'.join(body_bits) + '\n' return self.send_request('POST', ['_bulk'], body, encode_body=False, query_params=query_params) @es_kwargs('routing', 'parent', 'replication', 'consistency', 'refresh') def delete(self, index, doc_type, id, query_params=None): """ Delete a typed JSON document from a specific index based on its ID. :arg index: The name of the index from which to delete :arg doc_type: The type of the document to delete :arg id: The (string or int) ID of the document to delete See `ES's delete API`_ for more detail. .. _`ES's delete API`: http://www.elasticsearch.org/guide/reference/api/delete.html """ # id should never be None, and it's not particular dangerous # (equivalent to deleting a doc with ID "None", but it's almost # certainly not what the caller meant: if id is None or id == '': raise ValueError('No ID specified. To delete all documents in ' 'an index, use delete_all().') return self.send_request('DELETE', [index, doc_type, id], query_params=query_params) @es_kwargs('routing', 'parent', 'replication', 'consistency', 'refresh') def delete_all(self, index, doc_type, query_params=None): """ Delete all documents of the given doctype from an index. :arg index: The name of the index from which to delete. ES does not support this being empty or "_all" or a comma-delimited list of index names (in 0.19.9). :arg doc_type: The name of a document type See `ES's delete API`_ for more detail. .. _`ES's delete API`: http://www.elasticsearch.org/guide/reference/api/delete.html """ return self.send_request('DELETE', [index, doc_type], query_params=query_params) @es_kwargs('q', 'df', 'analyzer', 'default_operator', 'source' 'routing', 'replication', 'consistency') def delete_by_query(self, index, doc_type, query, query_params=None): """ Delete typed JSON documents from a specific index based on query. :arg index: An index or iterable thereof from which to delete :arg doc_type: The type of document or iterable thereof to delete :arg query: A dictionary that will convert to ES's query DSL or a string that will serve as a textual query to be passed as the ``q`` query string parameter. (Passing the ``q`` kwarg yourself is deprecated.) See `ES's delete-by-query API`_ for more detail. .. _`ES's delete-by-query API`: http://www.elasticsearch.org/guide/reference/api/delete-by-query.html """ if isinstance(query, string_types) and 'q' not in query_params: query_params['q'] = query body = '' else: body = query return self.send_request( 'DELETE', [self._concat(index), self._concat(doc_type), '_query'], body, query_params=query_params) @es_kwargs('realtime', 'fields', 'routing', 'preference', 'refresh') def get(self, index, doc_type, id, query_params=None): """ Get a typed JSON document from an index by ID. :arg index: The name of the index from which to retrieve :arg doc_type: The type of document to get :arg id: The ID of the document to retrieve See `ES's get API`_ for more detail. .. _`ES's get API`: http://www.elasticsearch.org/guide/reference/api/get.html """ return self.send_request('GET', [index, doc_type, id], query_params=query_params) @es_kwargs() def multi_get(self, ids, index=None, doc_type=None, fields=None, query_params=None): """ Get multiple typed JSON documents from ES. :arg ids: An iterable, each element of which can be either an a dict or an id (int or string). IDs are taken to be document IDs. Dicts are passed through the Multi Get API essentially verbatim, except that any missing ``_type``, ``_index``, or ``fields`` keys are filled in from the defaults given in the ``index``, ``doc_type``, and ``fields`` args. :arg index: Default index name from which to retrieve :arg doc_type: Default type of document to get :arg fields: Default fields to return See `ES's Multi Get API`_ for more detail. .. _`ES's Multi Get API`: http://www.elasticsearch.org/guide/reference/api/multi-get.html """ doc_template = dict( filter( itemgetter(1), [('_index', index), ('_type', doc_type), ('fields', fields)])) docs = [] for id in ids: doc = doc_template.copy() if isinstance(id, dict): doc.update(id) else: doc['_id'] = id docs.append(doc) return self.send_request( 'GET', ['_mget'], {'docs': docs}, query_params=query_params) @es_kwargs('routing', 'parent', 'timeout', 'replication', 'consistency', 'percolate', 'refresh', 'retry_on_conflict', 'fields') def update(self, index, doc_type, id, script=None, params=None, lang=None, query_params=None, doc=None, upsert=None): """ Update an existing document. Raise ``TypeError`` if ``script``, ``doc`` and ``upsert`` are all unspecified. :arg index: The name of the index containing the document :arg doc_type: The type of the document :arg id: The ID of the document :arg script: The script to be used to update the document :arg params: A dict of the params to be put in scope of the script :arg lang: The language of the script. Omit to use the default, specified by ``script.default_lang``. :arg doc: A partial document to be merged into the existing document :arg upsert: The content for the new document created if the document does not exist """ if script is None and doc is None and upsert is None: raise TypeError('At least one of the script, doc, or upsert ' 'kwargs must be provided.') body = {} if script: body['script'] = script if lang and script: body['lang'] = lang if doc: body['doc'] = doc if upsert: body['upsert'] = upsert if params: body['params'] = params return self.send_request( 'POST', [index, doc_type, id, '_update'], body=body, query_params=query_params) def _search_or_count(self, kind, query, index=None, doc_type=None, query_params=None): if isinstance(query, string_types): query_params['q'] = query body = '' else: body = query return self.send_request( 'GET', [self._concat(index), self._concat(doc_type), kind], body, query_params=query_params) @es_kwargs('routing', 'size') def search(self, query, **kwargs): """ Execute a search query against one or more indices and get back search hits. :arg query: A dictionary that will convert to ES's query DSL or a string that will serve as a textual query to be passed as the ``q`` query string parameter :arg index: An index or iterable of indexes to search. Omit to search all. :arg doc_type: A document type or iterable thereof to search. Omit to search all. :arg size: Limit the number of results to ``size``. Use with ``es_from`` to implement paginated searching. See `ES's search API`_ for more detail. .. _`ES's search API`: http://www.elasticsearch.org/guide/reference/api/search/ """ return self._search_or_count('_search', query, **kwargs) @es_kwargs('df', 'analyzer', 'default_operator', 'source', 'routing') def count(self, query, **kwargs): """ Execute a query against one or more indices and get hit count. :arg query: A dictionary that will convert to ES's query DSL or a string that will serve as a textual query to be passed as the ``q`` query string parameter :arg index: An index or iterable of indexes to search. Omit to search all. :arg doc_type: A document type or iterable thereof to search. Omit to search all. See `ES's count API`_ for more detail. .. _`ES's count API`: http://www.elasticsearch.org/guide/reference/api/count.html """ return self._search_or_count('_count', query, **kwargs) @es_kwargs() def get_mapping(self, index=None, doc_type=None, query_params=None): """ Fetch the mapping definition for a specific index and type. :arg index: An index or iterable thereof :arg doc_type: A document type or iterable thereof Omit both arguments to get mappings for all types and indexes. See `ES's get-mapping API`_ for more detail. .. _`ES's get-mapping API`: http://www.elasticsearch.org/guide/reference/api/admin-indices-get-mapping.html """ # TODO: Think about turning index=None into _all if doc_type is non- # None, per the ES doc page. return self.send_request( 'GET', [self._concat(index), self._concat(doc_type), '_mapping'], query_params=query_params) @es_kwargs('ignore_conflicts') def put_mapping(self, index, doc_type, mapping, query_params=None): """ Register specific mapping definition for a specific type against one or more indices. :arg index: An index or iterable thereof :arg doc_type: The document type to set the mapping of :arg mapping: A dict representing the mapping to install. For example, this dict can have top-level keys that are the names of doc types. See `ES's put-mapping API`_ for more detail. .. _`ES's put-mapping API`: http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html """ # TODO: Perhaps add a put_all_mappings() for consistency and so we # don't need to expose the "_all" magic string. We haven't done it yet # since this routine is not dangerous: ES makes you explicily pass # "_all" to update all mappings. return self.send_request( 'PUT', [self._concat(index), doc_type, '_mapping'], mapping, query_params=query_params) @es_kwargs('search_type', 'search_indices', 'search_types', 'search_scroll', 'search_size', 'search_from', 'like_text', 'percent_terms_to_match', 'min_term_freq', 'max_query_terms', 'stop_words', 'min_doc_freq', 'max_doc_freq', 'min_word_len', 'max_word_len', 'boost_terms', 'boost', 'analyzer') def more_like_this(self, index, doc_type, id, mlt_fields, body='', query_params=None): """ Execute a "more like this" search query against one or more fields and get back search hits. :arg index: The index to search and where the document for comparison lives :arg doc_type: The type of document to find others like :arg id: The ID of the document to find others like :arg mlt_fields: The list of fields to compare on :arg body: A dictionary that will convert to ES's query DSL and be passed as the request body See `ES's more-like-this API`_ for more detail. .. _`ES's more-like-this API`: http://www.elasticsearch.org/guide/reference/api/more-like-this.html """ query_params['mlt_fields'] = self._concat(mlt_fields) return self.send_request('GET', [index, doc_type, id, '_mlt'], body=body, query_params=query_params) ## Index Admin API @es_kwargs('recovery', 'snapshot') def status(self, index=None, query_params=None): """ Retrieve the status of one or more indices :arg index: An index or iterable thereof See `ES's index-status API`_ for more detail. .. _`ES's index-status API`: http://www.elasticsearch.org/guide/reference/api/admin-indices-status.html """ return self.send_request('GET', [self._concat(index), '_status'], query_params=query_params) @es_kwargs() def update_aliases(self, settings, query_params=None): """ Add, remove, or update aliases in bulk. :arg settings: a dictionary specifying the actions to perform See `ES's admin-indices-aliases API`_. .. _`ES's admin-indices-aliases API`: http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases.html """ return self.send_request('POST', ['_aliases'], body=settings, query_params=query_params) @es_kwargs() def aliases(self, index=None, query_params=None): """ Retrieve a listing of aliases :arg index: the name of an index or an iterable of indices See `ES's admin-indices-aliases API`_. .. _`ES's admin-indices-aliases API`: http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases.html """ return self.send_request('GET', [self._concat(index), '_aliases'], query_params=query_params) @es_kwargs() def create_index(self, index, settings=None, query_params=None): """ Create an index with optional settings. :arg index: The name of the index to create :arg settings: A dictionary of settings If the index already exists, raise :class:`~pyelasticsearch.exceptions.IndexAlreadyExistsError`. See `ES's create-index API`_ for more detail. .. _`ES's create-index API`: http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index.html """ return self.send_request('PUT', [index], body=settings, query_params=query_params) @es_kwargs() def delete_index(self, index, query_params=None): """ Delete an index. :arg index: An index or iterable thereof to delete If the index is not found, raise :class:`~pyelasticsearch.exceptions.ElasticHttpNotFoundError`. See `ES's delete-index API`_ for more detail. .. _`ES's delete-index API`: http://www.elasticsearch.org/guide/reference/api/admin-indices-delete-index.html """ if not index: raise ValueError('No indexes specified. To delete all indexes, use' ' delete_all_indexes().') return self.send_request('DELETE', [self._concat(index)], query_params=query_params) def delete_all_indexes(self, **kwargs): """Delete all indexes.""" return self.delete_index('_all', **kwargs) @es_kwargs() def close_index(self, index, query_params=None): """ Close an index. :arg index: The index to close See `ES's close-index API`_ for more detail. .. _`ES's close-index API`: http://www.elasticsearch.org/guide/reference/api/admin-indices-open-close.html """ return self.send_request('POST', [index, '_close'], query_params=query_params) @es_kwargs() def open_index(self, index, query_params=None): """ Open an index. :arg index: The index to open See `ES's open-index API`_ for more detail. .. _`ES's open-index API`: http://www.elasticsearch.org/guide/reference/api/admin-indices-open-close.html """ return self.send_request('POST', [index, '_open'], query_params=query_params) @es_kwargs() def get_settings(self, index, query_params=None): """ Get the settings of one or more indexes. :arg index: An index or iterable of indexes See `ES's get-settings API`_ for more detail. .. _`ES's get-settings API`: http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings.html """ return self.send_request('GET', [self._concat(index), '_settings'], query_params=query_params) @es_kwargs() def update_settings(self, index, settings, query_params=None): """ Change the settings of one or more indexes. :arg index: An index or iterable of indexes :arg settings: A dictionary of settings See `ES's update-settings API`_ for more detail. .. _`ES's update-settings API`: http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.html """ if not index: raise ValueError('No indexes specified. To update all indexes, use' ' update_all_settings().') # If we implement the "update cluster settings" API, call that # update_cluster_settings(). return self.send_request('PUT', [self._concat(index), '_settings'], body=settings, query_params=query_params) @es_kwargs() def update_all_settings(self, settings, query_params=None): """ Update the settings of all indexes. :arg settings: A dictionary of settings See `ES's update-settings API`_ for more detail. .. _`ES's update-settings API`: http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.html """ return self.send_request('PUT', ['_settings'], body=settings, query_params=query_params) @es_kwargs('refresh') def flush(self, index=None, query_params=None): """ Flush one or more indices (clear memory). :arg index: An index or iterable of indexes See `ES's flush API`_ for more detail. .. _`ES's flush API`: http://www.elasticsearch.org/guide/reference/api/admin-indices-flush.html """ return self.send_request('POST', [self._concat(index), '_flush'], query_params=query_params) @es_kwargs() def refresh(self, index=None, query_params=None): """ Refresh one or more indices. :arg index: An index or iterable of indexes See `ES's refresh API`_ for more detail. .. _`ES's refresh API`: http://www.elasticsearch.org/guide/reference/api/admin-indices-refresh.html """ return self.send_request('POST', [self._concat(index), '_refresh'], query_params=query_params) @es_kwargs() def gateway_snapshot(self, index=None, query_params=None): """ Gateway snapshot one or more indices. :arg index: An index or iterable of indexes See `ES's gateway-snapshot API`_ for more detail. .. _`ES's gateway-snapshot API`: http://www.elasticsearch.org/guide/reference/api/admin-indices-gateway-snapshot.html """ return self.send_request( 'POST', [self._concat(index), '_gateway', 'snapshot'], query_params=query_params) @es_kwargs('max_num_segments', 'only_expunge_deletes', 'refresh', 'flush', 'wait_for_merge') def optimize(self, index=None, query_params=None): """ Optimize one or more indices. :arg index: An index or iterable of indexes See `ES's optimize API`_ for more detail. .. _`ES's optimize API`: http://www.elasticsearch.org/guide/reference/api/admin-indices-optimize.html """ return self.send_request('POST', [self._concat(index), '_optimize'], query_params=query_params) @es_kwargs('level', 'wait_for_status', 'wait_for_relocating_shards', 'wait_for_nodes', 'timeout') def health(self, index=None, query_params=None): """ Report on the health of the cluster or certain indices. :arg index: The index or iterable of indexes to examine See `ES's cluster-health API`_ for more detail. .. _`ES's cluster-health API`: http://www.elasticsearch.org/guide/reference/api/admin-cluster-health.html """ return self.send_request( 'GET', ['_cluster', 'health', self._concat(index)], query_params=query_params) @es_kwargs('filter_nodes', 'filter_routing_table', 'filter_metadata', 'filter_blocks', 'filter_indices') def cluster_state(self, query_params=None): """ The cluster state API allows to get comprehensive state information of the whole cluster. (Insert es_kwargs here.) See `ES's cluster-state API`_ for more detail. .. _`ES's cluster-state API`: http://www.elasticsearch.org/guide/reference/api/admin-cluster-state.html """ return self.send_request( 'GET', ['_cluster', 'state'], query_params=query_params) @es_kwargs() def percolate(self, index, doc_type, doc, query_params=None): """ Run a JSON document through the registered percolator queries, and return which ones match. :arg index: The name of the index to which the document pretends to belong :arg doc_type: The type the document should be treated as if it has :arg doc: A Python mapping object, convertible to JSON, representing the document Use :meth:`index()` to register percolators. See `ES's percolate API`_ for more detail. .. _`ES's percolate API`: http://www.elasticsearch.org/guide/reference/api/percolate/ """ return self.send_request('GET', [index, doc_type, '_percolate'], doc, query_params=query_params) class JsonEncoder(json.JSONEncoder): def default(self, value): """Convert more Python data types to ES-understandable JSON.""" iso = _iso_datetime(value) if iso: return iso if not PY3 and isinstance(value, str): return unicode(value, errors='replace') # TODO: Be stricter. if isinstance(value, set): return list(value) return super(JsonEncoder, self).default(value) def _iso_datetime(value): """ If value appears to be something datetime-like, return it in ISO format. Otherwise, return None. """ if hasattr(value, 'strftime'): if hasattr(value, 'hour'): return value.isoformat() else: return '%sT00:00:00' % value.isoformat()
16进制计算器代码输入的16进制不能转换为十进制
#include<cstdlib> #include<iostream> #include<cctype> #include<cstring> #define STACK_INIT_SIZE 100 #define SIZE_INCREMENT 5 using namespace std; typedef struct { int *base; int *top; int stacksize; }SqStack,*SQSTACK; int StackInit(SQSTACK s) { s->base=(int*)malloc(STACK_INIT_SIZE * sizeof(int)); if(!(s->base)) exit(0); s->top=s->base; s->stacksize=STACK_INIT_SIZE; return 1; } int PUSH(SQSTACK s, int e) { if((s->base+s->stacksize)==s->top) { s->base=(int *)realloc(s->base,(SIZE_INCREMENT+s->stacksize)*sizeof(int)); s->top=s->base+s->stacksize; s->stacksize+=SIZE_INCREMENT; } *(s->top)=e; s->top+=1; return 1; } int POP(SQSTACK s, int *p) { if(s->base==s->top) return 0; *p=*(s->top-1); s->top--; return 1; } int StackLength(SQSTACK s) { return (s->top-s->base); } int StackFree(SQSTACK s) { free(s->base); s->top=s->base=NULL; return 1; } class Hexadecimal { public: Hexadecimal() { numstr='\0'; } int otherToDec(int sys, char* in_str); char* decToOther(unsigned int num,int sys); void parenthesisMatch(char *expr); int pri(char op); char * toPostfix(char * infix); int calc(int d1,char op,int d2); int eval(char* postfix); char* getnumstr(void); void setnumstr(char *str); /*bool ishex(char op);*/ //char* toString(); private: char * numstr; }; int Hexadecimal::otherToDec(int sys, char* in_str) { int i,j,length,start=0; unsigned long sum=0,pow; int *in_bit; length=strlen(in_str); if(!(in_bit=(int*)malloc(sizeof(int)*length))){ cout<<"Allocation error in otherToDec()!"; exit(0); } if(in_str[0]=='-') start++; j=0; for(i=length-1;i>=start;i--) { if(in_str[i]>='0' && in_str[i]<='9') in_bit[j]=in_str[i]-'0'; else if(in_str[i]>='A' && in_str[i]<='F') in_bit[j]=in_str[i]-'A'+10; else if(in_str[i]>='a' && in_str[i]<='f') in_bit[j]=in_str[i]-'a'+10; else exit(0); j++; } length-=start; for(i=0;i<length;i++) { if(in_bit[i]>=sys) { cout<<"Invalid number!"; exit(0); } for(j=1,pow=1;j<=i;j++) pow*=sys; sum+=in_bit[i]*pow; } return sum; } char* Hexadecimal::decToOther(unsigned int num,int sys) { SqStack s; int rem,i,length,num1,inc=1; char *out,*p; if(!StackInit(&s)) exit(0); do{ if((int)num<(int)sys) { rem=num; PUSH(&s,rem); break; } else { rem=num%sys; PUSH(&s,rem); num=num/sys; } }while(num); if(sys==16) inc++; length=StackLength(&s); if(!(out=(char*)malloc(sizeof(char)*length+inc))) { cout<<"Allocation error in decToOther()!"; exit(0); } p=out; if(sys==16) for(i=1;i<=length;i++) { POP(&s,&num1); if(num1<10) *p++=num1+'0'; else *p++=num1+'A'-10; } StackFree(&s); *p='\0'; return (out); } void Hexadecimal::parenthesisMatch(char *expr) { SqStack s; int i,len,no; if(!StackInit(&s)) exit(0); len=strlen(expr); for(i=1;i<=len;i++) { if(expr[i-1]=='(') PUSH(&s,i); else if(expr[i-1]==')') { if(POP(&s,&no)) cout<<"parathesis matching:"<<no <<"--"<<i<<endl; else { cout<<"The No."<<no<<" left parathes is not match with right parathesis!"<<endl; continue; } } } while(StackLength(&s)>0) { POP(&s,&no); cout<<"The No."<<no<<" left parathes is not matching with a right one!"<<endl; } StackFree(&s); } int Hexadecimal::pri(char op) { switch(op) { case '+': case'-': return 1; case '*': case '/': return 2; default: return 0; } } char * Hexadecimal::toPostfix(char * infix) { int length=strlen(infix); char * stack,*buf,*p; char flag=0; char op; int i,top=0; if(!(stack=(char*)malloc(sizeof(char)*length))) { cout<<"Allocation error in toPostfix()--stack!"<<endl; exit(0); } if(!(buf=(char*)malloc(sizeof(char)*(length*2)))) { cout<<"Allocation error in toPostfix()--buf!"<<endl; exit(0); } p=buf; for(i=0;i<length;i++) { op=infix[i]; switch(op) { case '(': if(top<length) { top++; stack[top]=op; } flag=0; break; //case '-': case '+': // case '*': case '/': while(pri(stack[top])>=pri(op)) { *p++=stack[top];//save the operator in string top--; flag=0;//flag=1 mean postfix can output number } if(top<length) { top++; stack[top]=op; if(flag==1) { *p++=','; /*while(*p-- != '\0' || *p-- != ',')//store a operand { char * temp='\0'; *temp++=*p; }*/ flag=0; } } break; case '-': if(i==0) { i++; break; } else { while(pri(stack[top])>=pri(op)) { *p++=stack[top];//save the operator in string top--; flag=0;//flag=1 mean postfix can output number } if(top<length) { top++; stack[top]=op; if(flag==1) { *p++=','; /*while(*p-- != '\0' || *p-- != ',')//store a operand { char * temp='\0'; *temp++=*p; }*/ flag=0; } } } break; case ')': while(stack[top]!='(') { *p++=stack[top]; top--; } flag=0; top--; break; default: /* if(isalpha(op)) { if(op>='0' && op<='9') op=op-'0'; else if(op>='A' && op<='F') op=op-'A'+10; else if(op>='a' && op<='f') op=op-'a'+10; }*/ if(isdigit(op) || (isalpha(op)&&(tolower(op)<='f'||tolower(op)>='a')))//prevent the invalid hexadeciaml number inputting { *p++=op; flag=1; } else { cout<<"Invalid expression!\n"; exit(0); } break; } } while(top>0) { *p++=stack[top];//pop out the operator that in stack top--;//modifify the stack pointer } delete stack; stack=NULL; *p='\0'; return (buf); } int Hexadecimal::calc(int d1,char op,int d2) { switch(op) { case '+': return d1+d2; case '-': return d1-d2; case '*': return d1*d2; case '/': if(d2==0) { cout<<"NaN!(Denominator is zero.)"; exit(0); } else return d1/d2; } return 0; } int Hexadecimal::eval(char* postfix) { int *stack,num,k=1; int i,length,top=0,dec=0,flag; char token; length=strlen(postfix); if(!(stack=(int*)malloc(sizeof(int)*length))) { cout<<"Allocation error in eval--stack"<<endl; exit(0); } num=0; for(i=0;i<length;i++) { token=postfix[i]; switch(token) { case '+': case '*': case '/': if(top <length && flag==1) { top++; stack[top]=(int)num; num=0; }//overload a function to implement convert stack[top-1]=calc(/*otherToDec(10,*/stack[top-1],token,/*otherToDec(10,*/stack[top]); top--; dec=0; flag=0; break; case '-': if(i==0) { i++; break; } else { top++; stack[top]=(int)num; num=0; } stack[top-1]=calc(/*otherToDec(10,*/stack[top-1],token,/*otherToDec(10,*/stack[top]); top--; dec=0; flag=0; break; default: if(token == ',') { if(top<length) { top++; stack[top]=(int)num; num=0; dec=0; break; } } else if(token =='.') { k=1; dec=1; break; } if(dec==1) { k=k*1; num=num+(token-'0')*k; } else { num=num*10+token-'0'; } flag=1; break; } } return stack[top]; } char* Hexadecimal::getnumstr(void) { return numstr; } void Hexadecimal::setnumstr(char *str) { numstr=str; } char* toLower(char * str); /* 1.thre problem in dealing with the first '-'. 2.if enter a char(a-f), output will become negative number.*/ int main() { char str[100]={'c'}; Hexadecimal hex; cout<<"Enter a arithematic: \n"; cin>>str; hex.parenthesisMatch(str);//parathesis matching char *temp='\0'; while(str !=0 && strcmp(toLower(str),"quit")) { hex.setnumstr(str); hex.parenthesisMatch(str); int sum=hex.eval(hex.toPostfix(hex.getnumstr()));//maybe this exist a problem,because the sum is a valid number---very big! int i=0; temp=str; while(temp!=0 && i<(int)strlen(temp) && strcmp(toLower(temp),"quit")) { cout<<temp[i]<<endl; i++; } cout<<"="<<hex.decToOther(sum,16); if(!strcmp(toLower(str),"quit")) { exit(1); } if(!*str) { cout<<"Space arithematic!"<<endl; continue; } cout<<"\nEnter a arithematic: \n"; cin>>str; cout<<endl; } //char * temp=; //delete temp; //temp=NULL; return 0; } char* toLower(char * str) { int i=0; while(i <(int)(strlen(str))) { str[i]=tolower(str[i]); i++; } return str; }
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私有的数
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
此博客仅为我业余记录文章所用,发布到此,仅供网友阅读参考,如有侵权,请通知我,我会删掉。 补充 有不少读者留言说本文章没有用,因为天气预报直接打开手机就可以收到了,为何要多此一举发送到邮箱呢!!!那我在这里只能说:因为你没用,所以你没用!!! 这里主要介绍的是思路,不是天气预报!不是天气预报!!不是天气预报!!!天气预报只是用于举例。请各位不要再刚了!!! 下面是我会用到的两个场景: 每日下
面试官问我:什么是消息队列?什么场景需要他?用了会出现什么问题?
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸,打败了无数
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外
大学四年自学走来,这些珍藏的「实用工具/学习网站」我全贡献出来了
知乎高赞:文中列举了互联网一线大厂程序员都在用的工具集合,涉及面非常广,小白和老手都可以进来看看,或许有新收获。
《阿里巴巴开发手册》读书笔记-编程规约
Java编程规约命名风格 命名风格 类名使用UpperCamelCase风格 方法名,参数名,成员变量,局部变量都统一使用lowerCamelcase风格 常量命名全部大写,单词间用下划线隔开, 力求语义表达完整清楚,不要嫌名字长 ...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip install selenium -i https://pypi.tuna.tsinghua.edu.cn/simple/ 
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
你知道的越多,你不知道的越多 点赞再看,养成习惯 本文 GitHub https://github.com/JavaFamily 已收录,有一线大厂面试点思维导图,也整理了很多我的文档,欢迎Star和完善,大家面试可以参照考点复习,希望我们一起有点东西。 前前言 为啥今天有个前前言呢? 因为你们的丙丙啊,昨天有牌面了哟,直接被微信官方推荐,知乎推荐,也就仅仅是还行吧(心里乐开花)
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca
Python爬虫精简步骤1 获取数据
爬虫的工作分为四步: 1.获取数据。爬虫程序会根据我们提供的网址,向服务器发起请求,然后返回数据。 2.解析数据。爬虫程序会把服务器返回的数据解析成我们能读懂的格式。 3.提取数据。爬虫程序再从中提取出我们需要的数据。 4.储存数据。爬虫程序把这些有用的数据保存起来,便于你日后的使用和分析。 这一篇的内容就是:获取数据。 首先,我们将会利用一个强大的库——requests来获取数据。 在电脑上安装
Python绘图,圣诞树,花,爱心 | Turtle篇
1.画圣诞树 import turtle screen = turtle.Screen() screen.setup(800,600) circle = turtle.Turtle() circle.shape('circle') circle.color('red') circle.speed('fastest') circle.up() square = turtle.Turtle()
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东
破14亿,Python分析我国存在哪些人口危机!
2020年1月17日,国家统计局发布了2019年国民经济报告,报告中指出我国人口突破14亿。 猪哥的朋友圈被14亿人口刷屏,但是很多人并没有看到我国复杂的人口问题:老龄化、男女比例失衡、生育率下降、人口红利下降等。 今天我们就来分析一下我们国家的人口数据吧! 更多有趣分析教程,扫描下方二维码关注vx公号「裸睡的猪」 即可查看! 一、背景 1.人口突破14亿 2020年1月17日,国家统计局发布
听说想当黑客的都玩过这个Monyer游戏(1~14攻略)
第零关 进入传送门开始第0关(游戏链接) 请点击链接进入第1关: 连接在左边→ ←连接在右边 看不到啊。。。。(只能看到一堆大佬做完的留名,也能看到菜鸡的我,在后面~~) 直接fn+f12吧 &lt;span&gt;连接在左边→&lt;/span&gt; &lt;a href="first.php"&gt;&lt;/a&gt; &lt;span&gt;←连接在右边&lt;/span&gt; o
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ......
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!
别低估自己的直觉,也别高估自己的智商
所有群全部吵翻天,朋友圈全部沦陷,公众号疯狂转发。这两周没怎么发原创,只发新闻,可能有人注意到了。我不是懒,是文章写了却没发,因为大家的关注力始终在这次的疫情上面,发了也没人看。当然,我...
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。   再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。   下文是原回答,希望能对你能有所启发。   如果我说,这个世界上人真的分三六九等,
为什么听过很多道理,依然过不好这一生?
记录学习笔记是一个重要的习惯,不希望学习过的东西成为过眼云烟。做总结的同时也是一次复盘思考的过程。 本文是根据阅读得到 App上《万维钢·精英日课》部分文章后所做的一点笔记和思考。学习是一个系统的过程,思维模型的建立需要相对完整的学习和思考过程。以下观点是在碎片化阅读后总结的一点心得总结。
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合
如何优雅地打印一个Java对象?
你好呀,我是沉默王二,一个和黄家驹一样身高,和刘德华一样颜值的程序员。虽然已经写了十多年的 Java 代码,但仍然觉得自己是个菜鸟(请允许我惭愧一下)。 在一个月黑风高的夜晚,我思前想后,觉得再也不能这么蹉跎下去了。于是痛下决心,准备通过输出的方式倒逼输入,以此来修炼自己的内功,从而进阶成为一名真正意义上的大神。与此同时,希望这些文章能够帮助到更多的读者,让大家在学习的路上不再寂寞、空虚和冷。 ...
雷火神山直播超两亿,Web播放器事件监听是怎么实现的?
Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题,让视音频内容可以不依赖用户安装App,就能进行播放以及在社交平台进行传播。在视频业务大数据平台中,播放数据的统计分析非常重要,所以Web播放器在使用过程中,需要对其内部的数据进行收集并上报至服务端,此时,就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢? 01 监听事件明细表 名
3万字总结,Mysql优化之精髓
本文知识点较多,篇幅较长,请耐心学习 MySQL已经成为时下关系型数据库产品的中坚力量,备受互联网大厂的青睐,出门面试想进BAT,想拿高工资,不会点MySQL优化知识,拿offer的成功率会大大下降。 为什么要优化 系统的吞吐量瓶颈往往出现在数据库的访问速度上 随着应用程序的运行,数据库的中的数据会越来越多,处理时间会相应变慢 数据是存放在磁盘上的,读写速度无法和内存相比 如何优化 设计
Linux 命令(122)—— watch 命令
1.命令简介 2.命令格式 3.选项说明 4.常用示例 参考文献 [1] watch(1) manual
Linux 命令(121)—— cal 命令
1.命令简介 2.命令格式 3.选项说明 4.常用示例 参考文献 [1] cal(1) manual
记jsp+servlet+jdbc实现的新闻管理系统
1.工具:eclipse+SQLyog 2.介绍:实现的内容就是显示新闻的基本信息,然后一个增删改查的操作。 3.数据库表设计 列名 中文名称 数据类型 长度 非空 newsId 文章ID int 11 √ newsTitle 文章标题 varchar 20 √ newsContent 文章内容 text newsStatus 是否审核 varchar 10 news...
Python新型冠状病毒疫情数据自动爬取+统计+发送报告+数据屏幕(三)发送篇
今天介绍的项目是使用 Itchat 发送统计报告 项目功能设计: 定时爬取疫情数据存入Mysql 进行数据分析制作疫情报告 使用itchat给亲人朋友发送分析报告(本文) 基于Django做数据屏幕 使用Tableau做数据分析 来看看最终效果 目前已经完成,预计2月12日前更新 使用 itchat 发送数据统计报告 itchat 是一个基于 web微信的一个框架,但微信官方并不允
作为程序员的我,大学四年一直自学,全靠这些实用工具和学习网站!
我本人因为高中沉迷于爱情,导致学业荒废,后来高考,毫无疑问进入了一所普普通通的大学,实在惭愧...... 我又是那么好强,现在学历不行,没办法改变的事情了,所以,进入大学开始,我就下定决心,一定要让自己掌握更多的技能,尤其选择了计算机这个行业,一定要多学习技术。 在进入大学学习不久后,我就认清了一个现实:我这个大学的整体教学质量和学习风气,真的一言难尽,懂的人自然知道怎么回事? 怎么办?我该如何更好的提升
新来个技术总监,禁止我们使用Lombok!
我有个学弟,在一家小型互联网公司做Java后端开发,最近他们公司新来了一个技术总监,这位技术总监对技术细节很看重,一来公司之后就推出了很多"政策",比如定义了很多开发规范、日志规范、甚至是要求大家统一使用某一款IDE。 但是这些都不是我这个学弟和我吐槽的点,他真正和我吐槽的是,他很不能理解,这位新来的技术总监竟然禁止公司内部所有开发使用Lombok。但是又没给出十分明确的,可以让人信服的理由。 于...
前端JS初级面试题二 (。•ˇ‸ˇ•。)老铁们!快来瞧瞧自己都会了么
1. 传统事件绑定和符合W3C标准的事件绑定有什么区别? 传统事件绑定 &lt;div onclick=""&gt;123&lt;/div&gt; div1.onclick = function(){}; &lt;button onmouseover=""&gt;&lt;/button&gt; 注意: 如果给同一个元素绑定了两次或多次相同类型的事件,那么后面的绑定会覆盖前面的绑定 (不支持DOM事...
2020金三银四,一篇文章教你如何征服面试官,拿到offer
2020年,跳槽面试就靠它们了,现在每天刷题,看源码文档,最近看的这些题目还是有些难度,有一部分我都要好好想一想才能回答出来,或者回答不出来,总的来说知识宽度够了深度还跟不上。所以要重点突破下底层的东西。这篇文章我总结了很久,希望对正在准备面试的同仁们有点帮助。没错我就是传说中的面霸!! 一. 面试准备 首先,是笔试题,这点是初级程序员绕不过去的坎。 笔试题一般的公司都会出的,除非你是大牛,可以选...
用Python开发实用程序 – 计算器
作者:隋顺意 一段时间前,自己制作了一个库 “sui-math”。这其实是math的翻版。做完后,python既然可以轻易的完成任何的数学计算,何不用python开发一个小程序专门用以计算呢? 现在我们越来越依赖于计算器,很多复杂的计算都离不开它。我们使用过各式各样的计算器,无论是电脑自带的,还是网也上的计算器,却都没有自己动手编写属于自己计算器。今天就让我们走进计算器的世界,用python来编写...
Python学习笔记(语法篇)
本篇博客大部分内容摘自埃里克·马瑟斯所著的《Python编程:从入门到实战》(入门类书籍),采用举例的方式进行知识点提要 关于Python学习书籍推荐文章 《学习Python必备的8本书》 Python语法特点: 通过缩进进行语句组织 不需要变量或参数的声明 冒号 1 变量和简单数据结构 1.1 变量命名 只能包含字母、数字和下划线,且不能以数字打头。 1.2 字符串 在Python中,用引号...
相关热词 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数 c#日期精确到分钟 c#自定义异常必须继承 c#查表并返回值 c# 动态 表达式树 c# 监控方法耗时 c# listbox c#chart显示滚动条
立即提问