使用类模板时报了一些错误,求改正。。。

#include <iostream>
using namespace std;
template <typename T>
class array
{
private:
T *A;
int L;
public:
array(int a);
array();
array(array<T> &);
void datain(T a);
friend array<T> operator+(array<T>&a,array<T>&b);
friend int big(array<T>&a,array<T>&b);
void operator=(const array<T>&);
void show();
T average();
~array();
};
template <typename T>
array<T>::array(int a)
{
int c=0;
A=new T[a];
while (c<a)
{
cin>>A[c];
c++;
}
L=a;
}
template <typename T>
array<T>::array()
{
A=NULL; L=0;
}
template <typename T>
array<T>::~array()
{
delete []A;
}
template <typename T>
array<T>::array(array<T> &p)
{
L=p.L;
A=new T[L];
for (int j=0;j<L;j++)
A[j]=p.A[j];
}
template <typename T>
void operator=(const array<T>& p)
{
L=p.L;
A=new T[L];
for (int j=0;j<L;j++)
A[j]=p.A[j];
}
template <typename T>
void array<T>::datain(T a)
{
A[L-1]=a;
}
template <typename T>
friend int big(array<T>&a,array<T> &b)
{
if (a.L>=b.L)
return a.L;
else
return b.L;
}
template <typename T>
friend array<T> operator+(array<T>&a,array<T>&b)
{
array<T> c;
int BIG=big(a,b);
c.L=BIG;
c.A=new T[BIG];
for (int i=0;i<BIG;i++)
{
c.A[i]=a.A[i]+b.A[i];
}
return c;
}
template <typename T>
T array<T>::average()
{
T all=0;
for (int i=0;i<L;i++)
{
all+=A[i];
}
return all/L;
}
template <typename T>
void array<T>::show()
{
for (int i=0;i<L;i++)
cout<<A[i]<<" ";
cout<<endl;
}
int main()
{
array<int> A1(3);
A1.show();
A1.datain(6);
A1.show();
cout<<A1.average()<<endl;
array<int> B(3);
array<int> C;
C=A1+B;
C.show();
return 0;
}图片

3个回答

先说下几个明显点的问题吧:
1.所有的<>,<<符号都打错了,可以按Shift+space转换下。
2.友元函数在类外实现的时候不用加friend。
3.“=”赋值运算符重载实现的时候没有加“array::”。
4.重载的+这个函数若是两个长度不相等的array相加就会造成越界,假设b.L为3,a.L为2,那么for循环里面最后会出现c.A[3]=a.A[3]+b.A[3],显然a.A这个数组根本没有这个下标,它最多为a.A[2]。可以用两个循环给要返回的数组赋值,先赋值两个都有元素的位置,再复制另一个里面多余的元素到相应的位置。

u010776685
Crazy_Plus 回复YXTS122: 不客气
接近 3 年之前 回复
YXTS122
YXTS122 template<T>friend array<T> operator++(array<T>&,array<T>&); 刚刚试着改成这样,果然可以运行了,谢谢了!
接近 3 年之前 回复
u010776685
Crazy_Plus 回复YXTS122: 哦,那问题解决了吧
接近 3 年之前 回复
YXTS122
YXTS122 <><<这些符号我是特意写成中文下的,我知道要写成英文下。因为用手机提问,所以得这样写,要不然<>这些符号显示不出来
接近 3 年之前 回复
u010776685
Crazy_Plus 你的big函数里面的if (a.L>=b.L),>和=中间多了个空格!,还有模板类中的友元函数前面要加上template<typename T>,这样就解决所有的问题了
接近 3 年之前 回复
u010776685
Crazy_Plus 第三条那里应该是array<T>::
接近 3 年之前 回复
YXTS122
YXTS122 你那个跟我的一点关系都没有
接近 3 年之前 回复
 #include<iostream>
using namespace std;
template <typename T>
class array
{
public:
      T *A;
    int L;
    array(int a);
    array();
    array(array<T> &);
    void datain(T a);
    template<T> friend array<T> operator+(array<T>&a,array<T>&b);
    template<T>friend int big(array<T>&a,array<T>&b);
    void operator=(const array<T>&);
    void show();
    void average();
    ~array();
};
template <typename T>
array<T>::array(int a)
{
    int c=0;
    A=new T[a];
    while (c<a)
    {
        cin>>A[c];
        c++;
    }
        L=a;
}
template <typename T>
array<T>::array()
{
    A=NULL;   L=0;
}
template <typename T>
array<T>::~array()
{
    delete []A;
}
template <typename T>
array<T>::array(array<T> &p)
{
    L=p.L;
    A=new T[L];
    for (int j=0;j<L;j++)
        A[j]=p.A[j];
}
template <typename T>
void array<T>::operator=(const array<T>& p)
{
    L=p.L;
    A=new T[L];
    for (int j=0;j<L;j++)
          A[j]=p.A[j];
}
template <typename T>
void array<T>::datain(T a)
{
    A[L-1]=a;
}
template <typename T>
int big(array<T>&a,array<T>&b)
{
    if (a.L>=b.L)
    return a.L;
    else
       return b.L;
}
template <typename T>
array<T> operator+(array<T>&a,array<T>&b)
{
    int i,x;
    array<T>  c;
    int BIG=big(a,b);
    c.L=BIG;
    c.A=new T[BIG];
    if (a.L<b.L)
         x=a.L;
    else if (a.L>=b.L)
         x=b.L;
    for (i=0;i<x;i++)
    {
        c.A[i]=a.A[i]+b.A[i];
    }
    if (a.L<b.L)
         for (;i<b.L;i++)
              c.A[i]=b.A[i];
     else if (a.L>=b.L)
          for (;i<a.L;i++)
               c.A[i]=a.A[i];
    return c;
}
template <typename T>
void  array<T>::average()
{
    T all=0;
    for (int i=0;i<L;i++)
    {
        all+=A[i];
    }
    cout<<all/L<<endl;
}
template <typename T>
void array<T>::show()
{
    for (int i=0;i<L;i++)
        cout<<A[i]<<" ";
     cout<<endl;
}
int main()
{
    array<int>A1(3);
    A1.show();
    A1.datain(6);
    A1.show();
    A1.average();
    array<int>B(2);
    array<int>  C;
    C=A1+B;
    C.show();
    return 0;
}
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
求改正一段js错误
var divs ="
一个代码的错误求改正!
#include rnusing namespace std;rn//////////形状类/////////////////////rnclass CShapernrnpublic:rn virtual double GetArea() = 0;rn;rn//////////////圆类///////////////////////rnconst double g_Pi = 3.1415926;rnclass CCircle : public CShapernrn CCircle()rn rnrn rnrn CCircle(double r) : m_dRadius(r)rn rn rn rnrn ~CCircle()rn rnrn rnrn void SetRadius(double r)rn rn m_dRadius = r;rn rnpublic:rn virtual double GetArea()rn rn return m_dRadius* m_dRadius * g_Pi;rn rnrnprotected:rn double m_dRadius; //半径rn;rn//////////////长方形类//////////////////////rnclass CRect:public CShapernrn CRect()rn rnrnrn rn CRect(double a,double b)rn rnrnrn rn ~CRect()rn rnrnrn rn void SetLength (double a,double b)rn rn m_dLength1 = a;rn m_dLength2 = b;rn rn rn rnpublic:rn virtual double GetArea()rn rn return m_dLength1 * m_dLength2;rn rn rnprotected:rn double m_dLength1; //边长rn double m_dLength2;rn rn;rnrn/////////主函数////////////////////////rnvoid main()rnrn CShape* pCircle = new CCircle(5);rn pCircle->GetArea();rn delete pCircle;rnrn rn CRect box(10,5);rn box.GetArea();rnrnrn编译时出现这个错误:error C2248: 'CCircle::CCircle' : cannot access private member declared in class 'CCircle'rn error C2248: 'CRect::CRect' : cannot access private member declared in class 'CRect'rn error C2248: 'CRect::~CRect' : cannot access private member declared in class 'CRecrn怎么改正错误啊??????????rnrnrnrn
数据写到Kafka报了一些错误,// 未完
RuntimeException org.apache.kafka.common.errors.NetworkException ERROR KafkaProducer: org.apache.kafka.common.errors.NotLeaderForPartitionException org.apache.kafka.common.errors.NetworkException org....
新人碰到一些错误无法改正
[code=c]#includern#includernusing namespace std;rnclass Pointrn public:rn Point(float x,float y)rn rn pointx=x;rn pointy=y;rn rn void showpoint()rn rn cout<<"点的坐标为:("<' : function-style initializer appears to be a function definitionrnp152_5.cpp(33) : error C2660: 'dist' : function does not take 2 parametersrnp152_5.cpp(34) : error C2660: 'dist' : function does not take 2 parametersrnrn能不能详细解答一下?rn题目是设计一个点类,其中包括一对坐标点数据成员,一个求两个点之间距离的友元函数dist和显示坐标点的成员函数,且用数据进行测试
使用stl类模板出现错误
1,想在A模板类中调用B类的test方法,代码如下;rntest.hrn[code=c]rn#pragma oncerntemplaternclass Arnrnpublic:rn void button1click();rn;rntemplaternvoid A::button1click()rnrn T.test();rnrn[/code]rntestcmd2010.cpprn[code=c]rn#include "stdafx.h"rn#include "Test.h"rn#include rnusing namespace std;rnclass Brnrnpublic:rn void test()rn rn cout<<"test"< a;rn a.button1click();rnrn[/code]rn错误信息 rnerror C2143: syntax error : missing ';' before '.' e:\projects\testcmd2010\testcmd2010\test.h 11 1 TestCmd2010rnrn2,还有如何在A类模板类中使用B的指针来调用B的方法test()rn用类指针来使用class A和 class Brn就是 用C++ 带指针参数的类模板 rn大概想把button1click方法和main函数改为如下代码rn[code=c]rntemplaternvoid A<*T>::button1click()rnrn T->test();rnrnint main( )rnrn A a = new A();rn a->button1click();rnrn[/code]rnrn rn
类模板的错误
大家好,请看rn例题:用类模板重载+,—,=实现三维坐标的+,-,=运算。rn我的程序为rn#includern#includernusing namespace std;rntemplate rnclass Pointrnrn T x,y,z;rnpublic:rn Point(T a=0,T b=0,T c=0);rn void disp(); rn Point operator+(Point B);rn Point operator-(Point B);rn void operator=(Point B);rn; rn[color=#FF0000]templatePoint::Point(T a=0,T b=0,T c=0):x(a),y(b),z(c)[/color]rn[color=#0000FF]template Point Point::operator+(Point B)[/color]rn rn Point C;rn C.x=x+B.x;C.y=y+B.y;C.z=z+B.z;rn return C; rn rntemplatePoint Point::operator-(Point B)rn rn Point C;rn C.x=x-B.x;C.y=y-B.y;C.z=z-B.z;rn return C; rn rntemplatevoid Point::operator=(Point B)rn rn x=B.x;y=B.y;z=B.z; rn rntemplatevoid Point::disp()rn rn cout<<"x="<::Point(T,T,T)'rn蓝色的行也有错误。请问哪里错了?
Oracle登陆时报了一个错误,ORA-00600
用户登录时,oracle报了一个错误 ORA-00600:内部错误代码,参数:【18062】,【】,【】,【】,【】,【】,【】,【】rnrn出错原因已经找到,是由于我把global_name设置为空了,有大神遇到过这样的错误么??如何恢复~~~跪求大神
求救:项目发布时报了一堆错误!!!!
严重: Exception starting filter struts2rnUnable to load bean: type:com.opensymphony.xwork2.ObjectFactory class:org.apache.struts2.spring.StrutsSpringObjectFactory - bean - jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/JSPDataDictionary/WEB-INF/lib/struts2-spring-plugin-2.0.11.2.jar!/struts-plugin.xml:30:132rn at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:208)rn at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)rn at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:131)rn at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)rn at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)rn at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)rn at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)rn at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)rn at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)rn at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108)rn at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4356)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:924)rn at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:887)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)rn at org.apache.catalina.core.StandardService.start(StandardService.java:516)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:578)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)rnCaused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAwarern at java.lang.ClassLoader.defineClass1(Native Method)rn at java.lang.ClassLoader.defineClass(Unknown Source)rn at java.security.SecureClassLoader.defineClass(Unknown Source)rn at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1819)rn at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1327)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)rn at java.lang.ClassLoader.loadClassInternal(Unknown Source)rn at java.lang.ClassLoader.defineClass1(Native Method)rn at java.lang.ClassLoader.defineClass(Unknown Source)rn at java.security.SecureClassLoader.defineClass(Unknown Source)rn at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1819)rn at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1327)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)rn at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:139)rn at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:180)rn ... 33 morern2008-8-6 16:08:09 org.apache.catalina.core.StandardContext startrn严重: Error filterStartrn2008-8-6 16:08:09 org.apache.catalina.core.StandardContext startrn严重: Context [/JSPDataDictionary] startup failed due to previous errorsrnlog4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources).rnlog4j:WARN Please initialize the log4j system properly.rnrn谁能帮我分析一下错误的原因啊,是缺少了什么库,还是设置的问题啊???多谢了
使用ITK的itkGeodesicActiveContourLevelSetImageFilter时,报错,求解释,求改正
[img=https://img-bbs.csdn.net/upload/201308/11/1376199802_648039.jpg][/img]rn是对dicom图像处理时才出现这种问题,对jpg或者png能够分割,代码如下:rn[code=c]#include "itkGeodesicActiveContourLevelSetImageFilter.h"rn#include "itkCurvatureAnisotropicDiffusionImageFilter.h"rn#include "itkGradientMagnitudeRecursiveGaussianImageFilter.h"rn#include "itkSigmoidImageFilter.h"rn#include "itkFastMarchingImageFilter.h"rn#include "itkRescaleIntensityImageFilter.h"rn#include "itkBinaryThresholdImageFilter.h"rn#include "itkImageFileReader.h"rn#include "itkImageFileWriter.h"rn#include "itkGDCMImageIO.h"rn#include "itkJPEGImageIO.h"rnrnint main()rnrn typedef float InternalPixelType;rn const unsigned int Dimension = 2;rn typedef itk::Image< InternalPixelType, Dimension > InternalImageType;rnrn typedef unsigned char OutputPixelType;rn typedef itk::Image< OutputPixelType, Dimension > OutputImageType;rn typedef itk::BinaryThresholdImageFilter ThresholdingFilterType;rnrn ThresholdingFilterType::Pointer thresholder = ThresholdingFilterType::New();rnrn thresholder->SetLowerThreshold( -1000.0 );rn thresholder->SetUpperThreshold( 0 );rnrn thresholder->SetOutsideValue( 0 );rn thresholder->SetInsideValue( 255 );rn// ************* reader ****************************** //rnrn typedef itk::ImageFileReader< InternalImageType > ReaderType;rn ReaderType::Pointer reader = ReaderType::New();rn// reader->SetFileName("C:\\Users\\zhq\\Desktop\\BrainProtonDensitySlice.png");rn reader->SetImageIO(itk::GDCMImageIO::New());rn reader->SetFileName("C:\\Users\\zhq\\Desktop\\data\\SNAP_CR\\E403434298\\E403434298S1901I301.dcm");rn// reader->SetImageIO(itk::JPEGImageIO::New());rn// reader->SetFileName("C:\\Users\\zhq\\Desktop\\data\\picture8\\1.jpeg");rn// reader->SetFileName("C:\\Users\\zhq\\Desktop\\\\1.jpg");rn reader->Update();rn std::cout<<"reader update"< WriterType;rn WriterType::Pointer writer = WriterType::New();rn writer->SetFileName("C:\\Users\\zhq\\Desktop\\ActiveContour.png");rnrnrn// ************* finish writer ********************** //rnrn typedef itk::RescaleIntensityImageFilter CastFilterType;rnrn typedef itk::GradientMagnitudeRecursiveGaussianImageFilter GradientFilterType;rn typedef itk::SigmoidImageFilter SigmoidFilterType;rnrn GradientFilterType::Pointer gradientMagnitude = GradientFilterType::New();rnrn SigmoidFilterType::Pointer sigmoid = SigmoidFilterType::New();rnrn sigmoid->SetOutputMinimum( 0.0 );rn sigmoid->SetOutputMaximum( 1.0 );rnrn typedef itk::FastMarchingImageFilter FastMarchingFilterType;rnrn FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New();rnrn typedef itk::GeodesicActiveContourLevelSetImageFilter< InternalImageType,rn InternalImageType > GeodesicActiveContourFilterType;rn GeodesicActiveContourFilterType::Pointer geodesicActiveContour =rn GeodesicActiveContourFilterType::New();rnrn const double propagationScaling = 0.4;rnrn geodesicActiveContour->SetPropagationScaling( propagationScaling );rn geodesicActiveContour->SetCurvatureScaling( 1.0 );rn geodesicActiveContour->SetAdvectionScaling( 1.0 );rnrn geodesicActiveContour->SetMaximumRMSError( 0.02 );rn geodesicActiveContour->SetNumberOfIterations( 800 );rnrn gradientMagnitude->SetInput( reader->GetOutput() );rn sigmoid->SetInput( gradientMagnitude->GetOutput() );rnrn geodesicActiveContour->SetInput( fastMarching->GetOutput() );rn geodesicActiveContour->SetFeatureImage( sigmoid->GetOutput() );rnrn thresholder->SetInput( geodesicActiveContour->GetOutput() );rn writer->SetInput( thresholder->GetOutput() );rnrn const double sigma = 0.4 ;rn gradientMagnitude->SetSigma( sigma );rnrn const double alpha = -0.2;rn const double beta = 10;rnrn sigmoid->SetAlpha( alpha );rn sigmoid->SetBeta( beta );rnrn typedef FastMarchingFilterType::NodeContainer NodeContainer;rn typedef FastMarchingFilterType::NodeType NodeType;rnrn NodeContainer::Pointer seeds = NodeContainer::New();rnrn InternalImageType::IndexType seedPosition;rnrn seedPosition[0] = 370;//661 ; //370 ; // 81;rn seedPosition[1] = 443;//559 ; //443 ; // 114;rnrn const double initialDistance = 5;rnrn NodeType node;rnrn const double seedValue = - initialDistance;rnrn node.SetValue( seedValue );rn node.SetIndex( seedPosition );rnrn seeds->Initialize();rn seeds->InsertElement( 0, node );rnrn fastMarching->SetTrialPoints( seeds );rnrn fastMarching->SetSpeedConstant( 1.0 );rnrn fastMarching->SetOutputSize(rn reader->GetOutput()->GetBufferedRegion().GetSize() );rnrn gradientMagnitude->Update();rn std::cout<<"gradientMagnitude update"<Update();rn std::cout<<"sigmoid update"<SetOutputSize(rn reader->GetOutput()->GetBufferedRegion().GetSize() );rnrn fastMarching->Update();rn std::cout<<"fastMarching update"<Update();rn std::cout<<"geodesicActiveContour update"<Update();rn std::cout<<"writer update"<GetNumberOfIterations() << std::endl;rn std::cout << "Max. RMS error: " << geodesicActiveContour->GetMaximumRMSError() << std::endl;rn std::cout << std::endl;rn std::cout << "No. elpased iterations: " << geodesicActiveContour->GetElapsedIterations() << std::endl;rn std::cout << "RMS change: " << geodesicActiveContour->GetRMSChange() << std::endl;rnrn return 0;rnrn[/code]
Java插入数据时报了ora-01502错误
2017-05-03 18:45:20.830 c.s.d.p.s.b.TgsVehicleToOracleBolt_XZ [ERROR] ORA-01502: 绱㈠?'JCPT_HC3.SYS_C0010810' 骅跨被绱㈠肩                                                                                   
在阿里云服务器上安装mysql时报了下面的错误。
[root@AY1402151723210855acZ mysql]# rpm -ivh MySQL-server-5.6.16-1.el6.x86_64.rpm rnerror: Failed dependencies:rn libc.so.6(GLIBC_2.10)(64bit) is needed by MySQL-server-5.6.16-1.el6.x86_64rn libc.so.6(GLIBC_2.7)(64bit) is needed by MySQL-server-5.6.16-1.el6.x86_64rn libc.so.6(GLIBC_2.8)(64bit) is needed by MySQL-server-5.6.16-1.el6.x86_64rn libstdc++.so.6(GLIBCXX_3.4.11)(64bit) is needed by MySQL-server-5.6.16-1.el6.x86_64rn rpmlib(FileDigests) <= 4.6.0-1 is needed by MySQL-server-5.6.16-1.el6.x86_64rn rpmlib(PayloadIsXz) <= 5.2-1 is needed by MySQL-server-5.6.16-1.el6.x86_64
求改正
//输入十个整数要求将最小的数与第一个数交换,把最大的数与最后一个数交换rn#includernusing namespace std;rnvoid input(int *p,int n)rnrn int i;rn for(i=0;i>*(p+i);rnrnvoid exchange(int *p,int n)rnrn int min,max,i,k,x,m,y;rn min=*p;rn max=*p;rn for(i=1;i*(p+i))min=*(p+i);k=i;rn if(max<*(p+i))max=*(p+i);x=i;rn rn m=*p;*p=min;*(p+i)=m;rn y=*(p+n-1);*(p+n-1)=max;*(p+x)=y;rnrnvoid print(int *p,int n)rnrn int i;rn for(i=0;i
求改正!
这是我写的代码:rn#includernmain()rnint i;rnint a[10],b[10];rnint *p;rnint *q;rnp=a;rnq=b;rnprintf("please enter 10 score to a[]");rnfor(i=0;i<10;i++)rnrnscanf("%d",&a[i]);rnrnprintf("please enter 10 score to b[]");rnfor(i=0;i<10;i++)rnrnscanf("%d",&b[i]);rnrnswap(int a[10],int b[10]);rnfor(i=0;i<10;i++)rnrn printf("%d",a[i]);rnrnprintf("\n");rnfor(i=0;i<10;i++)rnrn printf("%d",b[i]);rnrnrnswap(int a[],int b[])rnrnint temp;rntemp=*p;rn*p=*q;rn*q=temp;rn
使用类模板时的一点困惑
1 #includestring> 2 #include 3 4 using namespace std; 5 6 ///通过嵌套实现元则 7 template 8 class my_tuple 9 { 10 public: 11 T value; 12 N next; 13 my_tuple(T const &v,N const
报了一个致命的错误
#rn# A fatal error has been detected by the Java Runtime Environment:rn#rn# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100a7f17, pid=296, tid=680rn#rn# JRE version: 7.0_05-b05rn# Java VM: Java HotSpot(TM) Client VM (23.1-b03 mixed mode, sharing windows-x86rn)rn# Problematic frame:rn# C [GOOGLEPINYIN2.IME+0xa7f17] DllRegisterServer+0x43d47rn#rn# Failed to write core dump. Minidumps are not enabled by default on client verrnions of Windowsrn#rn# An error report file with more information is saved as:rn# D:\JAVA\lianxi\day22\hs_err_pid296.logrn#rn# If you would like to submit a bug report, please visit:rn# http://bugreport.sun.com/bugreport/crash.jsprn# The crash happened outside the Java Virtual Machine in native code.rn# See problematic frame for where to report the bug.rn#rnrnD:\JAVA\lianxi\day22>
报了一个编码错误??
[code=JScript]rn[color=#0000FF]rn他的编码方式我已经改成utf-8怎么还不对???rnrnjava.lang.Exception: The Category '??????????±?' is not foundrn at cn.igsnrr.escience.geodata.category.CategoryDetails.getInstance(CategoryDetails.java:19)rn at cn.igsnrr.escience.geodata.category.ListCategoryAction.execute(ListCategoryAction.java:34)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)rn at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)rn at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)rn at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)rn at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)rn[/color]rnrnrn[/code]
c语言编写错误,求改正
[img=http://img.my.csdn.net/uploads/201212/05/1354671433_6445.png][/img][img=http://img.my.csdn.net/uploads/201212/05/1354671171_5090.png][/img]这个程序是排序算法,其中的一些算法出现错误,但是不会改,希望有人帮忙改正。
VB6错误求改正:WebBrowser3.Document.FontName = "宋体"?
VB6错误求改正:WebBrowser3.Document.FontName = "宋体"?rn应该怎么改才能设定WebBrowser的字体信息?
新手,求判断错误并改正
[code=c]rnrnint ReadData_DN_raw(char *filename,NSSData *m_NSSData)rn int i,j,k;rn FILE *file;rnchar trdata[10];rnshort **a;rnm_file = fopen(filename,"r");rnif(m_file == NULL)rnreturn -1;rnrnrn........rnfor(j=0;jObsDN[k].a[i][j] = atoi(strdata);[/color]rnrnrnrnrnrnrnrn[/code]
delphi 7 clientdataset 使用的BUG型错误求改正
错误是基于一个托盘系统上的,当程序托盘时,我把鼠标移到托盘洗图标后,会有一个提示信息,代码如下:rnprocedure Tmainform.WndProc(var Msg:TMessage);rnvarrn pt:TPoint;rnbeginrn if Msg.Msg = WM_TRAYNOTIFY thenrn beginrn // IconID:= Msg.WParam;rn GetCursorPos(pt);rn case Msg.LParam ofrn WM_LBUTTONUP:rn beginrn //释放鼠标左键rn end;rn WM_RBUTTONUP:rn beginrn //释放鼠标右键rn end;rn WM_MOUSEMOVE:rn beginrn //鼠标在图标上移动rn //NotifyIcon.szTip := '移动';rn[color=#FF6600] StrpCopy(NotifyIcon.szTip, pchar(getstr));rn Shell_NotifyIcon(NIM_MODIFY, @NotifyIcon);[/color]rn end;rnrn红色部分就是当我把鼠标移动到图标后,执行 getstr 函数,返回值就是提示信息rnrngetstr的代码如下:rnfunction getstr: string;rnvarrn str11,str33,str44:string;rnbeginrn with datamodule1.search_sql_cds dorn beginrn close;rn commandtext:='SQL语句';rn open;rn str11:='0';rn str33:='0';rn str44:='0';rn datamodule1.search_sql_cds.First;rn while not datamodule1.search_sql_cds.Eof dorn beginrn str11:=floattostr(strtofloat(str11)+strtofloat(datamodule1.search_sql_cds.FieldByName('1').asstring));rn str33:=floattostr(strtofloat(str33)+strtofloat(datamodule1.search_sql_cds.FieldByName('2').asstring));rn str44:=floattostr(strtofloat(str44)+strtofloat(datamodule1.search_sql_cds.FieldByName('3').asstring));rn datamodule1.search_sql_cds.Next;rn end;rn end;rnrn Result:= str11+str33+str44;rn end;rnrn大概意思就是用 clientdataset 通过SocketConnection1,SimpleObjectBroker1连接oracle数据库 。rnrn[color=#FF0000]rn但是我如果不用clientdataset连接服务器上的oracle数据库 ,改成adodataset连接本地的SQL数据库的话,就没有运行错误。[/color]rnrn以下是我用clientdataset连接服务器上的oracle数据库,运行后,将鼠标移到图标上时出现的错误:rnrn---------------------------rnDebugger Exception Notificationrn---------------------------rnProject helansale.exe raised exception class EDatabaseError with message 'Invalid data packet'. Process stopped. Use Step or Run to continue.rn---------------------------rnOK Help rn---------------------------rnrnrn我的代码为了保密有所改动,但是是没有语法错误的,而且调试的时候也是没有问题的,有高手知道这个问题的所在嘛?rn怎么修改?加分求指教rn
c++宝贵错误与改正
c++宝贵错误与改正
散分,错误改正
[img=http://hi.csdn.net/attachment/201002/18/808008_12664868562RPb.gif][/img]rnrnrn下边是下载rn[url=http://download.csdn.net/source/2065603][/url]rnrn一个简单的 通过 for in 方法来扁历对象的小东西,前些天发现几个严重的错误,自己修改了一下,还行吧..rnrnrn通过 ie6 ,ie7, opera9.0 ,firefox3.5 rnrn为什么我只能发表 100分的贴???rnrn
c# 语句错误改正
我用reflector 反编了一个程序,swicth反编成了goto之类的,有错误,哪位高手帮我看看,怎么修改。rn[code=C#]rn for (int i1 = 0; i1 < sqlParams.Length; i1++)rn rn string s = sqlParams[i1].DataType;rn if (s == System.String.Empty)rn goto label_1;rn switch (s)rn rn case "Int16\uFFFD":rn case "Int32\uFFFD":rn case "Int64\uFFFD":rn oracleParameter = new System.Data.OracleClient.OracleParameter(sqlParams[i1].Name, System.Data.OracleClient.OracleType.Int32);rn break;rnrn case "Double\uFFFD":rn case "Decimal\uFFFD":rn case "Single\uFFFD":rn oracleParameter = new System.Data.OracleClient.OracleParameter(sqlParams[i1].Name, System.Data.OracleClient.OracleType.Double);rn break;rnrn case "DateTime\uFFFD":rn case "TimeSpan\uFFFD":rn oracleParameter = new System.Data.OracleClient.OracleParameter(sqlParams[i1].Name, System.Data.OracleClient.OracleType.DateTime);rn break;rnrn case "Byte[]\uFFFD":rn oracleParameter = new System.Data.OracleClient.OracleParameter(sqlParams[i1].Name, System.Data.OracleClient.OracleType.Blob);rn break;rnrn case "String\uFFFD":rn oracleParameter = new System.Data.OracleClient.OracleParameter(sqlParams[i1].Name, System.Data.OracleClient.OracleType.VarChar, 10000);rn break;rnrn default:rn oracleParameter = new System.Data.OracleClient.OracleParameter(sqlParams[i1].Name, sqlParams[i1].Value);rn goto label_2;rn label_1:rn object obj1 = sqlParams[i1].Value;rn if (obj1.GetType() == typeof(System.DateTime))rn rn oracleParameter = new System.Data.OracleClient.OracleParameter(sqlParams[i1].Name, System.Data.OracleClient.OracleType.DateTime);rn rn else if (obj1.GetType() == typeof(string))rn rn int i2 = obj1.ToString().Length;rn oracleParameter = new System.Data.OracleClient.OracleParameter(sqlParams[i1].Name, System.Data.OracleClient.OracleType.VarChar, i2 == 0 ? 1 : i2);rn rn else if (obj1.GetType() == typeof(int))rn rn oracleParameter = new System.Data.OracleClient.OracleParameter(sqlParams[i1].Name, System.Data.OracleClient.OracleType.Int32);rn rn else if (obj1.GetType().Name.Equals("DataTable\uFFFD"))rn rn oracleParameter = new System.Data.OracleClient.OracleParameter(sqlParams[i1].Name, System.Data.OracleClient.OracleType.Cursor);rn rn else if (obj1.GetType().Name.Equals("OracleType.Clob\uFFFD"))rn rn oracleParameter = new System.Data.OracleClient.OracleParameter(sqlParams[i1].Name, System.Data.OracleClient.OracleType.Clob);rn rn elsern rn oracleParameter = new System.Data.OracleClient.OracleParameter(sqlParams[i1].Name, obj1);rn rn break;rn rn label_2:rn oracleParameter.Direction = sqlParams[i1].Direction;rn _Cmd.Parameters.Add(oracleParameter);rn rn rnrnrn[/code]rnrn另外 原来也有个final的错误,代码如下rnrn[code=C#]rn ~OracleWrapper()rn rn tryrn rn Close();rn rn catch rn rn rn finallyrn rn base.Finalize();rn rn rn[/code]rn我直接修改成了。rnrn[code=C#]rn ~OracleWrapper()rn rn rn Close();rn rn rn[/code]rnrn这样应该没问题吧,或者指导一下改成什么样比较合适,是否要保留try catch.rnrn谢谢。
调试时无错误,输出乱码,求改正
#includen#includentypedef struct lnodenn int data;n struct lnode *next;nlnode,*Linklist;nnnnLinklist create(Linklist L)nn int node;n Linklist p;n L=(Linklist)malloc(sizeof(lnode));n L->next=NULL;n printf("please input the node(end with 0):\n");n scanf("%d",&node);n while(node!=0)n n p=(Linklist)malloc(sizeof(lnode));n p->data=node;n p->next=L->next;n L->next=p;n scanf("%d",&node);n n return L;nnnnnvoid display(Linklist L)nn Linklist p;n p=L->next;n int element;n element=L->data;n while(p!=NULL)n n if(element>p->data)n n element=p->data;n n p=p->next;n n printf("the min element is:%d",element);nnnnmain()nn Linklist L=NULL;n L=create(L);n display(L);nn
这个错误如何改正
// 顺序表的类定义rntemplate class SeqListrnpublic: rn SeqList(int MaxSize=defaultSize); //构造函数rn ~SeqList() delete [] data; //析构函数rn int Length() constreturn last+1; //计算表长度rn int Find(Type &x) const; //定位函数:找x在表中位置rn int IsIn(Type &x); //判断x是否在表中rn int Insert(Type &x, int i); //插入x在表中第i个位置处rn int Remove(Type &x); //删除xrn int Next(Type &x); //寻找x的后继rn int Prior(Type &x); //寻找x的前驱rn int IsEmpty() return last==-1; //判断顺序表空否,空则返回1;否则返回0rn int IsFull() return last==MaxSize-1; //判断顺序表满否,满则返回1;否则返回0rn Type Get(int i) return i<0||i>last?NULL:data[i]; //取第i个元素的值rnprivate:rn Type *data; //顺序表的存放数组rn int MaxSize; //顺序表的最大可容纳项数rn int last; //顺序表当前已存表项的最后位置rn;rnrntemplate SeqList::SeqList(int sz)rn//构造函数,通过指定参数sz定义数组的长度。rn if(sz>0)rn MaxSize=sz; //顺序表长度rn last=-1; //置表的实际长度为空rn data=new Type[MaxSize]; //创建顺序表数组rn rnrnrntemplate int SeqList::Find(Type &x)const]rn//定位:找x在表中位置,若查找成功,函数返回表项的位置,否则函数返回 -1。rn int i=0;rn while(i<=last&&data[i]!=x) i++; //顺序查找rn if(i>last) return -1; //查找失败rn else return i; //查找成功rnrnrntemplate int SeqList::IsIn(Type &x)rn//判断x是否在表中。rn int i=0, found=0;rn while(i<=last&&!found) //顺序查找rn if(data[i]!=x) i++;rn else found=1; //查找成功rn return found;rnrnrntemplate int SeqList::Insert(Type &x, int i)rn//插入x在表中第i个位置处。函数返回插入是否成功的信息,若为0则插入不成功/rn if(i<0||i>last+1||last==MaxSize-1) return 0; //插入位置不合理,不能插入rn elsern last++; //表长度加1rn for(int j=last; j>i; j--) data[j]=data[j-1]; //依次后移rn data[i]=x; //插入rn return 1;rn rnrnrntemplate int SeqList:Remove(Type &x)rn//删除xrn int i=Find(x); //在表中查找xrn if(i>=0) //x在表中存在rn last--; //表长度减1 rn for(int j=i; j<=last; j++) data[j]=data[j+1]; //依次前移rn return 1;rn rnrn return 0; //x在表中不存在,不能删除rnrnrntemplate int SeqList::Next(Type &x)rn//寻找x的后继数据rn int i=Find(x);rn if(i>=0&&i int SeqList::Prior(Type &x)rn//寻找x的前驱rn int i=Find(x);rn if(i>0&&i<=last) return i-1; //x的前驱位置rn else return -1;rnrnrn/*运行结果:rn--------------------Configuration: P43 - Win32 Debug--------------------rnCompiling...rnP43.CPPrnE:\Program Files\Microsoft Visual Studio\MyProjects\我的《数据结构》\P43.CPP(69) : error C2936: 'SeqList' : template-class-id redefined as a global data variablernError executing cl.exe.rnrnP43.OBJ - 1 error(s), 0 warning(s)rn*/
使用类模板来设计类时,出现连接错误!!!!
各位大老们!!帮帮rn使用类模板来设计类时,把类成员函数的实现放到.cpp文件中rn 为什么会出现连接错误LNK2019,rn 但编译是通过的!!!
连接错误,怎么改正
各位高手,请问一下:这种连接错误是怎么回事,应该怎么改正呢? rnainFrm.obj : error LNK2001: unresolved external symbol "protected: void __thiscall CMainFrame::OnNewAddressEnter(void)" (?OnNewAddressEnter@CMainFrame@@IAEXXZ) rnRelease/ControlsPosition.exe : fatal error LNK1120: 1 unresolved externals
什么错误,怎么改正?
技术信息(用于支持人员)rnrn错误类型:rnADODB.Field (0x80020009)rnBOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。rn/finace/新建文件夹/public.asprnrnrn浏览器类型:rnMozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; MyIE2; (R1 1.5)) rnrn网页:rnPOST 66 ??? /finace/新建文件夹/public.asprnrnPOST Data:rnSpay_Type=ByMonth&spay_year=2004&spay_month=1&Submit2=%B2%E9%D1%AF rnrn时间:rn2004年9月1日, 13:32:38 rnrnrn详细信息:rnMicrosoft 支持
请教一些类模板问题
我菜鸟,不知道怎么回事,希望大家指导下:rn建三个文件:main.cpp(主),Lei.h(类(模板型)的定义),Lei.cpp(类的实现,构造函数及其他函数实现)rn这样写,一之说什么template错无,但是把Lei.h同Lei.cpp集中放在lei.h就没有事情了rnLei.cpp里也加入了头文件Lei.hrn应该是我的错误了,求高手给个三文件类模板实例.rn谢谢....
oracle中错误改正
java.sql.SQLException: Listener refused the connection with the following error:rnORA-12519, TNS:no appropriate service handler foundrnThe Connection descriptor used by the client was:rn127.0.0.1:1521:oraclernrn at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)rn at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:261)rn at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)rn at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:414)rn at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:165)rn at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)rn at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)rn at java.sql.DriverManager.getConnection(DriverManager.java:579)rn at java.sql.DriverManager.getConnection(DriverManager.java:221)rnrn求各位大神解答????
初学HIBERNATE,错误改正
1.向表中插入一个字段unit_id,然后回到modle类进行配置; 2.在modle里面开始配置 brand: private TbUnit tbUnit;get,set方法; unit: private Set brands;get,set方法; 然后配置xml:  TsBrand.hbn.xml:   TbUnit.hbm.xml:    单位ID
git pull错误改正
________________________________________________________________________________________________________________ 使用git pull origin master报错 a any carcloud/yzy/aiproforremote tzd denied by fa
怎样改正这个错误?
在用OPENGL,VC++做图形时,程序是:rnrn#include rnrnGLubyte wb[2]=0x00,0xff;rnGLubyte check[512];rnint ww;rnrnvoid init()rnrn glClearColor(1.0, 1.0, 0.0, 1.0);rnrnrnvoid display()rnrn glClear(GL_COLOR_BUFFER_BIT);rn glColor3f(1.0, 0.0, 0.0);rn glRasterPos2f(0.0, 0.0);rn glBitmap(64, 64, 0.0, 0.0, 0.0, 0.0, check);rn glFlush();rnrnrnvoid reshape(int w, int h)rnrn glViewport(0, 0, w, h);rn glMatrixMode(GL_PROJECTION);rn glLoadIdentity();rn gluOrtho2D (0.0, (GLfloat) w, 0.0, (GLfloat) h);rn ww=w;rn glMatrixMode(GL_MODELVIEW);rn glLoadIdentity();rnrnrnvoid mouse(int btn, int state, int x, int y)rnrnrn if(btn==GLUT_LEFT_BUTTON && state == GLUT_DOWN) rn rn glBitmap(64, 64, 0.0, 0.0, 0.0, 0.0, check);rn glRasterPos2i(x, ww-y);rn glBitmap(64, 64, 0.0, 0.0, 0.0, 0.0, check);rn glFlush();rn rnrnrnrnint main(int argc, char** argv)rnrnrn/* Initialize mode and open a window in upper left corner of screen */rn/* Window title is name of program (arg[0]) */rnrn int i,j;rn for(i=0;i<64;i++) for(j=0;j<8;j++) check[i*8+j] = wb[(i/8+j)%2];rn glutInit(&argc,argv); rn glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);rn glutInitWindowSize(500,500);rn glutInitWindowPosition(0,0); rn glutCreateWindow("bitmap");rn glutDisplayFunc(display);rn glutReshapeFunc(reshape);rn glutMouseFunc(mouse);rn init();rn glEnable(GL_COLOR_LOGIC_OP); rn glLogicOp(GL_XOR);rn glutMainLoop();rnrnrnrn会出现以下问题:rnbit.obj : error LNK2001: unresolved external symbol ___glutInitWithExit@12rnbit.obj : error LNK2001: unresolved external symbol ___glutCreateWindowWithExit@8rnDebug/bit.exe : fatal error LNK1120: 2 unresolved externalsrnError executing link.exe.rnrnbit.exe - 3 error(s), 0 warning(s)rn本人不知道如何改正,请各位大虾指点!rn
下面的错误如何改正?
function sel_onchange(val)rn switch(parseInt(val))rn case 1: func1();break;rn case 2: func2();break;rn case 3: func2();break;rn case 4: func2();break;rn rn rn function func1()document.evalformF.divFin.style.display='none';rn function func2()document.evalformF.divFin.style.display='';rnrnrn rn - rn Less than US$ 100.000rn US$ 100.000 to 200.000 rn US$ 200.000 to 600.000 rn More than US$ 600.000rn rnrn .....rnrnie报错在document.evalformF.divFin.style.displayrn说document.evalformF.divFin.style.display为空或不是对象rnrn如何改?
怎样改正以下的错误?
以下是做略缩图的,为什么运行不了?rnrn<%@ Import Namespace="System.Drawing.Imaging" %>rn<%@ Import Namespace="System.Drawing" %>rnrnrnrn rnrnrnrn rnrn rnrnrnrn
这种错误怎么改正?
e:\毕业设计\program6.0\sqlexecdll\SqlExecDlg.cpp(65): error C2440: “初始化” : 无法从“char [6]”转换为“SQLCHAR *”与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换rn
这个错误如何改正?
void main()rnrn char ch;rn cin>>ch;rn while (true)rn rn cout<<"true";rn if (ch=='4'|| ch=='6')rn rn cout<<"test";rn rn elsern break;rn rnrn这一段小程序为何编译的时候提示下面的错误,如何改正!rnnafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadexrnnafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadexrnDebug/t1.exe : fatal error LNK1120: 2 unresolved externalsrnError executing link.exe.rnrnt1.exe - 3 error(s), 0 warning(s)
这个错误怎么改正?
rnsql server中,这个函数该怎么改?rnalter FUNCTION getClassCodeForDZ (@janCode as int ,@fitDate as datetime ,@rcDBName as varchar(20)) rn RETURNS varchar(200) AS rnBEGIN rn declare @ClassCode varchar(20)rn declare @tableName varchar(100)rnrn set @tableName = @rcDBName + '..haha'rnrn select @ClassCode= column1+column2+column3 from @tableNamern rn return( @ClassCode)rnEND rnrn函数的功能是取一条记录的三个列相加 rn报错如下:Must declare the variable '@tableName'.rn
类模板概念,类模板定义、使用
本教程适合那些只有一点点c语言编程知识的新手,也适合那些c++98标准已经掌握的不错但对c++11/14/17新标准基本无所知的c++开发老手,欢迎大家尽早加入学习,请大家从授课目录,讲解课程时长、演示范例详尽程度,试听后收获四个方面评估本教程的质量。
类模板的使用
直接看一个例子 #include &amp;lt;iostream&amp;gt; using namespace std; template&amp;lt;class T1,class T2&amp;gt; class Point { private: T1 m_x;//x坐标 T2 m_y;//y坐标 public: Point(T1 x,T2 y):m_x(x),m_y(y){} T1 getX()const;//...
相关热词 c# stream 复制 android c# c#监测窗口句柄 c# md5 引用 c# 判断tabtip 自己写个浏览器程序c# c# 字符串变成整数数组 c#语言编程写出一个方法 c# 转盘抽奖 c#选中treeview